home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / adikit.arc / ADIKIT.DOC < prev    next >
Encoding:
Text File  |  1986-12-01  |  104.9 KB  |  2,638 lines

  1.  
  2.           Autodesk, Inc.
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                         Autodesk Device Interface/ADI
  18.  
  19.                              Driver Development Kit
  20.  
  21.                                   Version 2.1
  22.  
  23.                                     _______
  24.  
  25.  
  26.                                Graphics Displays
  27.  
  28.                                    Digitizers
  29.  
  30.                                     Plotters
  31.  
  32.                                 Printer/Plotters
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.           Publication TDADIDOC01.00                      December 1, 1986
  57.  
  58.  
  59.                            Product of Autodesk, Inc.
  60.  
  61.        This publication  is distributed  by Autodesk  so that independent
  62.        parties   can   develop   graphics   peripheral   device   drivers
  63.        independently of  Autodesk,  Inc.    This  publication,  or  parts
  64.        thereof, as  well as associated materials distributed on diskette,
  65.        and software  developed using  these materials,  i.e.  ADI  device
  66.        drivers  intended   to  function   with  Autodesk,  Inc.  software
  67.        products, may  be distributed  freely without royalty to Autodesk,
  68.        Inc., subject to the following conditions.
  69.  
  70.        Users of  the ADI  Driver Development  Kit are  granted a  limited
  71.        license to  use and/or  make copies  of these materials for use by
  72.        others in  order to develop graphics peripheral device drivers for
  73.        Autodesk products.  This limited license does not include:
  74.  
  75.           1. Distributing the  ADI Kit  in connection  with any  other
  76.              product.
  77.           2. Making the  ADI Kit  available for  any consideration  or
  78.              "disk fee."
  79.           3. Distributing the ADI Kit in modified form.
  80.  
  81.        Autodesk, Inc.  makes no  warranty, either  expressed or  implied,
  82.        including  but   not  limited   to  any   implied  warranties   of
  83.        merchantability or  fitness for  a particular  purpose,  regarding
  84.        these materials  and makes  such materials available on an "as-is"
  85.        basis.
  86.  
  87.        In no  event shall Autodesk, Inc. be liable to anyone for special,
  88.        collateral, incidental,  or consequential  damages  in  connection
  89.        with or  arising out  of purchase  or use of these materials.  The
  90.        sole and  exclusive liability to Autodesk, Inc., regardless of the
  91.        form of  action, shall  not  exceed  the  purchase  price  of  the
  92.        materials described herein.
  93.  
  94.        Autodesk, Inc.  reserves the  right to  revise and  improve  these
  95.        materials as it sees fit.  This publication describes the state of
  96.        the ADI  Kit at  the time  of its publication, and may not reflect
  97.        the ADI Kit at all times in the future.
  98.  
  99.        The latest  version of  the ADI  Driver Development Kit, including
  100.        printed documentation,  may be  obtained by sending $100 in check,
  101.        VISA, or MasterCard to:
  102.  
  103.                                 ADI Program
  104.                                 Autodesk, Inc.
  105.                                 2320 Marinship Way
  106.                                 Sausalito, California 94965
  107.  
  108.  
  109.  
  110.        Add $6 sales tax if you are located in California.
  111.  
  112.        Comments on  these materials are welcome.  Correspondence may also
  113.        be exchanged  on the  Autodesk, Inc. Forum on CompuServe.  Type GO
  114.        ADESK when you log on.
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.        IBM and PC-DOS are registered trademarks of International Business
  158.        Machines  Corporation.     MS-DOS  is  a  trademark  of  Microsoft
  159.        Corporation.     Intel  is   a  trademark  of  Intel  Corporation.
  160.        CompuServe is a registered trademark of CompuServe Incorporated.
  161.        AutoCAD is  a registered  trademark of  Autodesk, Inc.    Autodesk
  162.        Device Interface/ADI,  ADE,  3D  Level  1,  CAD/camera,  AutoLISP,
  163.        AutoSHADE, AutoSketch, and AutoCAD AEC are trademarks of Autodesk,
  164.        Inc.
  165.  
  166.  
  167.                                Table of Contents
  168.  
  169.  
  170.        Chapter 1  THE AUTODESK DEVICE INTERFACE/ADI ................ 1
  171.  
  172.            1.1 Overview ............................................ 1
  173.            1.2 Developer's Responsibilities ........................ 1
  174.            1.3 What You Need ....................................... 1
  175.            1.4 What The ADI Kit Includes ........................... 1
  176.            1.5 Working with ADI .................................... 1
  177.            1.6 Testing ............................................. 2
  178.            1.7 Releasing the Driver ................................ 2
  179.  
  180.        Chapter 2  THE ADI GRAPHICS DISPLAY SPECIFICATION ........... 3
  181.  
  182.            2.1 The ADI Graphics Display ............................ 3
  183.            2.2 Configuration ....................................... 3
  184.            2.3 The ADI Graphics Display Interface .................. 4
  185.            2.4 Writing Display Drivers ............................. 5
  186.            2.5 Display Driver Functions ............................ 6
  187.            2.6 AutoCADR Standard Colors ........................... 15
  188.            2.7 ADI Graphics Display Test Procedures ............... 16
  189.  
  190.        Chapter 3  THE ADI DIGITIZER SPECIFICATION ................. 21
  191.  
  192.            3.1 The ADI Digitizer .................................. 21
  193.            3.2 Configuration ...................................... 21
  194.            3.3 The ADI Digitizer Interface ........................ 21
  195.            3.4 ADI Digitizer Test Procedures ...................... 25
  196.  
  197.        Chapter 4  THE ADI PLOTTER SPECIFICATION ................... 29
  198.  
  199.            4.1 The ADI Plotter .................................... 29
  200.            4.2 Configuration ...................................... 29
  201.            4.3 Using the Driver ................................... 31
  202.            4.4 Output Format ...................................... 31
  203.                4.4.1 File Format .................................. 33
  204.            4.5 Installed Driver Operation ......................... 34
  205.            4.6 ADI Plotter Test Procedures ........................ 36
  206.  
  207.        Chapter 5  THE ADI PRINTER/PLOTTER SPECIFICATION ........... 37
  208.  
  209.            5.1 The ADI Printer/Plotter ............................ 37
  210.            5.2 Configuration ...................................... 37
  211.            5.3 Using the Driver ................................... 39
  212.            5.4 Output Format ...................................... 39
  213.            5.5 Installed Driver Operation ......................... 40
  214.            5.6 ADI Printer/Plotter Test Procedures ................ 42
  215.  
  216.        Appendix A  REVISION HISTORY ............................... 43
  217.  
  218.            A.1 ADI Display Interface Version 2.0 (October, 1986) .. 43
  219.            A.2 ADI Display Interface Version 2.1 (December, 1986) . 43
  220.  
  221.        __________________________________________________________________
  222.  
  223.  
  224.                                    Chapter 1
  225.  
  226.  
  227.                        THE AUTODESK DEVICE INTERFACE/ADI
  228.  
  229.        __________________________________________________________________
  230.  
  231.  
  232.        1.1 Overview
  233.  
  234.        The Autodesk  Device Interface  is an interface specification that
  235.        allows  manufacturers,  dealers  and  users  to  develop  graphics
  236.        peripheral drivers  that work  with MS-DOS  versions of  AutoCADR,
  237.        AutoSketchtm, and  other Autodesk  products.   By using the ADI, a
  238.        developer can  write, test,  distribute and  support a  peripheral
  239.        driver that  is compatible with Autodesk software products without
  240.        having to wait for Autodesk, Inc. to implement the driver.
  241.  
  242.        1.2 Developer's Responsibilities
  243.  
  244.        ADI drivers  are distributed and supported by the developer (you),
  245.        not by  Autodesk, Inc.   It is your responsibility to inform users
  246.        how to  install and  configure your driver and peripheral.  If you
  247.        are a peripheral manufacturer, and wish to use the ADI Development
  248.        Kit, you must supply Autodesk with the name of a technical support
  249.        contact person  in your  organization.  Autodesk's product support
  250.        staff will  be supplied  with a list of these names, and questions
  251.        from users  about your  driver will  be referred to that person in
  252.        your organization.
  253.  
  254.        1.3 What You Need
  255.  
  256.        To implement an ADI driver, you should be familiar with AutoCAD or
  257.        the Autodesk product you intend to support and its operation.  You
  258.        must  purchase   the  Autodesk   product  to  test  your  finished
  259.        interface.   An ADI driver may be written in any language that can
  260.        utilize MS-DOS  software interrupts; however, the examples in this
  261.        documentation are  in Lattice  C, version  2.14 or  2.151,  or  in
  262.        assembly language.
  263.  
  264.        1.4 What The ADI Kit Includes
  265.  
  266.        The ADI  Kit contains  C and  assembly language sample source code
  267.        and this  documentation.   The sample  source code, or any portion
  268.        thereof, can  be used  in your  ADI driver implementation, without
  269.        any royalties or additional fees paid to Autodesk, Inc.
  270.  
  271.        ____________________
  272.  
  273.        1The examples in the ADI Development Kit are intended for use with
  274.        Lattice C  version 2.14 or 2.15.  If you are using a later version
  275.        of this compiler, or another compiler, you will need to modify the
  276.        examples accordingly.
  277.  
  278.                                                                         1
  279.  
  280.                    The Autodesk Device Interface - Chapter 1
  281.  
  282.  
  283.        The disk  files also  include  batch  files,  link  files,  sample
  284.        installation guide text, and debugging aids.
  285.  
  286.        1.5 Working with ADI
  287.  
  288.        Because of resource limitations, Autodesk cannot provide technical
  289.        assistance to  ADI Kit  developers.  ADI Kit users are expected to
  290.        have  sufficient  technical  skills  to  implement  their  drivers
  291.        without assistance  from Autodesk.   If  a bug  or  deficiency  is
  292.        discovered in the ADI Kit, developers will be notified through the
  293.        Autodesk Forum on CompuServe.
  294.  
  295.        ADI Kit  users  may  wish  to  exchange  information  through  the
  296.        Developers' Corner  in the  Autodesk Forum on CompuServe.  Type GO
  297.        ADESK when you log on to CompuServe.
  298.  
  299.        1.6 Testing
  300.  
  301.        The importance  of testing  your finished  ADI  driver  cannot  be
  302.        overemphasized.   This  documentation  describes  the  tests  that
  303.        Autodesk's Quality  Assurance Department performs AS A MINIMUM for
  304.        every device  driver supported.  Since you are responsible for the
  305.        support of  the finished  ADI driver,  this testing is critical to
  306.        the success  of your  driver and also to reduce the volume of user
  307.        support calls  that may  be generated and directed to you due to a
  308.        malfunctioning driver.
  309.  
  310.        1.7 Releasing the Driver
  311.  
  312.        How you  distribute your ADI driver is up to you.  You may want to
  313.        ship it on a disk included with your product, or make it available
  314.        to  your   dealers.    The  AutoCAD  files  DSGEN.DRV,  DGGEN.DRV,
  315.        PLGEN.DRV, and  PPGEN.DRV may  not be  distributed by  you.  These
  316.        drivers  are   proprietary  Autodesk  software  products  and  are
  317.        specific to individual AutoCAD releases.  AutoCAD users may obtain
  318.        updates of  these drivers  (if necessary)  from  their  authorized
  319.        AutoCAD dealer.   Versions  of these  drivers are included in each
  320.        AutoCAD MS-DOS  release (along  with the  other peripheral  device
  321.        drivers).   Your driver  should continue to work with new releases
  322.        of Autodesk  software products  without any changes required.  New
  323.        features added  to the  ADI interface  may require that you update
  324.        your ADI driver in order to take advantage of them.
  325.  
  326.        Autodesk,  Inc.   may  choose   to  publish  a  list  of  hardware
  327.        manufacturers and  other developers  known to  have completed  ADI
  328.        device drivers.   These  lists may  be distributed  to dealers and
  329.        posted in  the Autodesk  Forum on  CompuServe.  To be eligible for
  330.        this list,  you must  send Autodesk, Inc. a copy, on disk, of your
  331.        completed ADI  driver, along with all user documentation.  Send it
  332.        to the ADI Program, Autodesk, Inc., 2320 Marinship Way, Sausalito,
  333.        CA 94965.
  334.  
  335.        2
  336.  
  337.       ___________________________________________________________________
  338.  
  339.                                    Chapter 2
  340.  
  341.  
  342.                      THE ADI GRAPHICS DISPLAY SPECIFICATION
  343.  
  344.        __________________________________________________________________
  345.  
  346.  
  347.        The following  describes, in  detail, the  interface specification
  348.        for ADI graphics display drivers.
  349.  
  350.        2.1 The ADI Graphics Display
  351.  
  352.        The ADI Driver Development Kit disk for graphics displays contains
  353.        source and  executable code  for an  ADI  Hercules  Graphics  Card
  354.        driver (DSHERC.C).   The  IWAIT.ASM routine  is also  on this disk
  355.        (more on  this later).   DSHERC.C  has numerous debugging features
  356.        and can  emulate a  dumb display  that clears  everything on  flip
  357.        screen, or  a  smart  one  with  higher  level  features  just  by
  358.        compiling with  DUMB or  SMART defined.   The  disk also  contains
  359.        source and  executable for  the DSDEMO  debugging aid,  as well as
  360.        ADI.H  (functions   common  to   all  ADI  drivers),  and  DSADI.H
  361.        (functions for graphics display drivers).
  362.  
  363.        2.2 Configuration
  364.  
  365.        The driver,  DSGEN.DRV, is  integrated into  selected versions  of
  366.        AutoCADR.  This driver appears on the AutoCAD Display options menu
  367.        as ADI display Vxx.1
  368.  
  369.        DSGEN.DRV performs  its functions  by calling a DOS "terminate and
  370.        stay resident"  display driver  (the  one  you  create)  installed
  371.        before AutoCAD  was executed.   When  AutoCAD is  configured  with
  372.        DSGEN.DRV,  one  of  the  configuration  questions  asked  is  the
  373.        interrupt vector  number used  to communicate  with your installed
  374.        driver.
  375.  
  376.        ____________________
  377.  
  378.        1DSGEN.DRV was  first distributed  in the  IBM PC/XT/AT version of
  379.        AutoCAD 2.18 shipped in March of 1986.  This driver appears as ADI
  380.        display v2.18 on the menu selection.  AutoCAD 2.18 users must have
  381.        this driver  for the  ADI graphics display to work--DSGEN.DRV with
  382.        an earlier  file date-stamp  will not  function correctly.    This
  383.        driver is  available to  users as  an update  from their  dealers.
  384.        AutoCAD 2.5  (or later  version) users  must  have  the  DSGEN.DRV
  385.        distributed with their AutoCAD.  See the appendix to this document
  386.        for a  list of which versions of DSGEN.DRV support which features.
  387.        To use  all of the extended functions of the ADI display interface
  388.        introduced in  this version  of the  kit (version 2.1), users must
  389.        have AutoCAD  2.52 and  the DSGEN.DRV  that appears in the AutoCAD
  390.        configuration menu as ADI display V2.1 (or later).
  391.  
  392.                                                                         3
  393.  
  394.                   ADI Graphics Display Version 2.1 - Chapter 2
  395.  
  396.  
  397.        The generic  display driver communicates with the installed driver
  398.        through the  registers AX,  BX, CX,  and DX.  Arguments are loaded
  399.        into these  registers and the driver is invoked with an INT to the
  400.        vector used  to call  the driver.   AX  is always  loaded  with  a
  401.        function code that selects the task the driver is to perform.  The
  402.        other registers have meanings that vary from function to function.
  403.  
  404.        The display  driver returns its status in the same four registers.
  405.        The meaning of the results returned depends upon the function.
  406.  
  407.        2.3 The AutoCAD Graphics Display Interface
  408.  
  409.        It is  necessary to  understand what the AutoCAD display interface
  410.        looks like  and how it works.  To accomplish this, it is suggested
  411.        that you  experiment with  AutoCAD and its features as they relate
  412.        to  the  display  (virtually  all  of  them  do).    Conceptually,
  413.        AutoCAD's display  interface uses two screens - a text screen of X
  414.        rows by  Y columns (the "hidden" screen), and a graphics screen of
  415.        X pixels  by Y pixels (see illustration in the Introduction to the
  416.        AutoCAD Drafting  Package Reference Manual).  The AutoCAD user may
  417.        flip between  these screens  at any time by the push of a function
  418.        key.   The text  screen contains  the last  25 lines of text.  The
  419.        graphics screen  is  logically  divided  into  four  windows:  the
  420.        graphics area,  the text  scrolling area, the status line, and the
  421.        screen menu area.  The last three of these areas can be configured
  422.        on or  off at the user's option, in order to maximize the graphics
  423.        area of  the screen.   Since  not all  display  hardware  has  the
  424.        ability to  store and  manipulate a complete graphics bitmap AND a
  425.        full screen  of text,  AutoCAD will take care of certain functions
  426.        that the  display device  cannot handle.  The ADI driver must tell
  427.        AutoCAD  what   capabilities  it   has   through   a   series   of
  428.        initialization calls.   For  example, if  the display  device  and
  429.        driver are  not capable  of storing  and  scrolling  an  80  x  25
  430.        character  text  screen,  AutoCAD  will  keep  a  buffer  of  2000
  431.        characters and scroll it as needed. There are two forms of display
  432.        devices: those  that can operate in a single screen mode and those
  433.        that operate  in a  dual screen mode.  Dual screen devices use one
  434.        monitor for  the graphics display and another monitor for the text
  435.        screen.   Examples of currently supported dual screen displays are
  436.        the Control Systems Artist I and the Number Nine Revolution board.
  437.        Single screen  displays use  only one monitor.  Examples of single
  438.        screen displays  are  the  Hercules  Graphics  Card  and  the  IBM
  439.        Enhanced Graphics Adapter.
  440.  
  441.        A user  configuring AutoCAD  for  use  with  an  ADI  driver  will
  442.        configure  AutoCAD  according  to  the  AutoCAD  Drafting  Package
  443.        Installation/Performance  Guide   for  an   ADI  display  and  the
  444.        instructions you provide.  You should fully acquaint yourself with
  445.        this process  in order to provide clear documentation for users of
  446.        your ADI driver.
  447.  
  448.        4
  449.  
  450.                   ADI Graphics Display Version 2.1 - Chapter 2
  451.  
  452.  
  453.        2.4 Writing Display Drivers
  454.  
  455.        Thanks to  a magical  routine called  IWAIT, display  drivers  may
  456.        easily be  written in  C.   A display  driver  should  be  written
  457.        essentially  as   a  large   loop.    After  doing  any  once-only
  458.        initialization, the driver should fall into a loop as follows:
  459.  
  460.           while (1) {
  461.              iwait(VECTOR, &iregs, &oregs);
  462.           ... processing ...
  463.           }
  464.  
  465.        IREGS  and   OREGS  are   structures  consisting  of  four  SHORTs
  466.        corresponding to the registers AX, BX, CX, and DX.  For example:
  467.  
  468.           struct cregs {
  469.              short ax, bx, cx, dx;
  470.           };
  471.           static struct cregs iregs, oregs;
  472.  
  473.        On the  first call  to IWAIT, the program will be installed at the
  474.        interrupt vector  given by  VECTOR, and  will terminate but remain
  475.        resident.   When a  user makes an INT to that vector, the contents
  476.        of his  AX through  DX will  be stored in IREGS and the IWAIT will
  477.        "return" to  the resident  program.   It may do whatever it likes,
  478.        then load its results in OREGS, and re-execute the IWAIT.  You may
  479.        notice that  IWAIT is a complement of the Computer Innovations C86
  480.        library function,  SYSINT (except  that it  uses fewer registers).
  481.        In fact,  a pair  of programs  doing SYSINTs  and  IWAITs  form  a
  482.        coroutine linkage.   IREGS and OREGS may (and usually will) be the
  483.        same structure.
  484.  
  485.        For  more  information  on  this  linkage  (which  makes  lots  of
  486.        difficult things easier to do), look at the demo program DSDEMO.C,
  487.        as well  as DSHERC.C.   The  ultimate reference, of course, is the
  488.        code in IWAIT.ASM.
  489.  
  490.        To aid in identifying the ADI driver, the developer should include
  491.        a message,  displayed at  driver load time, indicating the version
  492.        number of  the driver, the name of the developer, and the date the
  493.        driver was created.
  494.  
  495.                                    WARNING !!
  496.  
  497.        Both MS-DOS  and the Lattice C compiler rely on the decrement flag
  498.        being CLEAR.  If your driver sets the decrement flag (i.e. doesn't
  499.        perform a  CLD instruction  before returning to AutoCAD) horrible,
  500.        horrible things will probably happen.
  501.  
  502.                                                                         5
  503.  
  504.                   ADI Graphics Display Version 2.1 - Chapter 2
  505.  
  506.  
  507.        2.5 Display Driver Functions
  508.  
  509.        In the  following descriptions of the arguments passed to and from
  510.        the driver,  two items enclosed in parentheses means that they are
  511.        stored as  a single  16 bit value, with the first item in the most
  512.        significant 8  bits and the second item in the least significant 8
  513.        bits.
  514.  
  515.           INIT1       Code (AX): 1   Arg1 (BX)  =   (0, config)
  516.                                      Arg2 (CX)  =   (0, intlevel)
  517.           Result      Code (AX): ok  Res1 (BX)  =   ixdots
  518.                                      Res2 (CX)  =   iydots
  519.                                      Res3 (DX)  =   ixdotsm
  520.  
  521.        The INIT1  is the initial call to the driver.  The CONFIG argument
  522.        specifies the  screen configuration requested by the user when the
  523.        driver was  installed.   It is  a bit  coded value, with the 1 bit
  524.        indicating that  the text  scrolling area  is desired,  the 2  bit
  525.        indicating that  the screen  menu is  to be  drawn, and  the 4 bit
  526.        indicating  that  the  status  line  is  to  be  used.    INTLEVEL
  527.        identifies  the   version  of  the  driver  interface  for  upward
  528.        compatibility.   This version of the driver passes 3 for INTLEVEL.
  529.        The driver  returns IXDOTS  and IYDOTS  equal to one less than the
  530.        horizontal and  vertical size,  respectively, of the graphics area
  531.        of the  screen (less  menu,  scrolling  area,  and  status  line).
  532.        IXDOTSM is  the maximum  horizontal dot  number, including  screen
  533.        menu, beginning at zero (total dots in x direction = IXDOTSM + 1).
  534.        If the  device was  correctly initialized,  OK should  be returned
  535.        equal to 1, otherwise it should be set to 0.
  536.  
  537.           INIT2       Code (AX): 2
  538.                       Result         Res1 (BX)  =   (modelinl, mnuchars)
  539.                                      Res2 (CX)  =   (maxboxes, modes)
  540.                                      Res3 (DX)  =   (split, hwfill)
  541.  
  542.        The INIT2 call causes the driver to furnish additional information
  543.        to AutoCAD.   MODELINL  is the  number of characters available for
  544.        the mode  status line.   MNUCHARS  is  the  number  of  characters
  545.        available for screen menu items.  MAXBOXES is the number of screen
  546.        menu boxes  on the  screen.   MODES is  a  bit  coded  field  that
  547.        specifies modes  pertaining  to  the  operation  of  this  display
  548.        device.   The 1  bit indicates  that echoing  a Control  C to  the
  549.        screen while  in graphics  mode  will  destroy  the  display,  and
  550.        therefore that  Control C  should be suppressed.  This mode should
  551.        be set  only on  single screen  displays that  lack separate image
  552.        planes for  text and  graphics.   The 2  bit should be set if this
  553.        display implements  highlighting for  selected objects (preferably
  554.        by drawing them with dashed lines).  The 4 bit is set if this is a
  555.        single screen  that switches  between a  text screen  and graphics
  556.        screen, and  should be  clear if  the driver  supports a  separate
  557.        graphics screen.   If  this is  a  single  screen  display,  SPLIT
  558.        specifies the  number of  lines of  text that  appear in  the text
  559.  
  560.        6
  561.  
  562.                   ADI Graphics Display Version 2.1 - Chapter 2
  563.  
  564.        scrolling region  (normally three).   If  this is  a  dual  screen
  565.        display (bit  4 clear  in MODES),  SPLIT should  be set  to  zero.
  566.        HWFILL is  set to  0 for  devices without hardware fill, and 2 for
  567.        those with polygon fill (1 is not used).
  568.  
  569.           INIT3       Code (AX): 3
  570.           Result                     Res1 (BX)  =   pixwid
  571.                                      Res2 (CX)  =   pixhgt
  572.                                      Res3 (DX)  =   (hidlines, hidcols)
  573.  
  574.        The INIT3  call requests  further  information  from  the  driver.
  575.        PIXWID is  the horizontal  physical spacing  between  pixels,  and
  576.        PIXHGT is the vertical physical spacing between pixels.  The ratio
  577.        of PIXWID  and PIXHGT  is used  to correct  the "aspect  ratio" of
  578.        objects drawn  on the  screen  so  that  horizontal  and  vertical
  579.        measurements are  equal on  the screen.   On a device with "square
  580.        pixels", PIXWID  and PIXHGT  should both  be set to 1.  On devices
  581.        with different  X and  Y scales,  PIXWID and  PIXHGT should be set
  582.        based on the physical screen measurement in each direction divided
  583.        by the  number of  pixels on  that axis.  Only the ratio of PIXWID
  584.        and PIXHGT  is significant,  so any  desired units  may  be  used.
  585.        PIXWID and  PIXHGT should be made as accurate as possible; changes
  586.        in the  second decimal  place in the ratio make visible changes on
  587.        the screen.   PIXWID  and PIXHGT  must be  greater than 0 and less
  588.        than 32767.   The values HIDLINES and HIDCOLS (normally 25 and 80,
  589.        respectively) give  the number  of lines and characters to be used
  590.        for the  "hidden" screen.   If the driver does not require AutoCAD
  591.        to maintain  a hidden  screen, both  of  these  values  should  be
  592.        returned as 0.
  593.  
  594.           INIT4       Code (AX): 4
  595.           Result                     Res1 (BX)
  596.                                      Res2 (CX)
  597.  
  598.        The INIT4  function requests  further information from the driver.
  599.        Res1 and  Res2 are  the upper and lower halves (respectively) of a
  600.        32-bit flag  field, i.e.  [(Res1)(Res2)].   Each bit,  when set ON
  601.        (1), specifies the presence in the driver of a handler for various
  602.        extended functions.  The currently available functions are:
  603.  
  604.           Code        Function       Use
  605.           EF_SYNC     SYNC           Flush local display buffers
  606.           EF_REDRAW   REDRAW         Redraw from local display buffers
  607.                                      (or) clear local display buffers
  608.           EF_CMD      DSCOMAND       Register to receive commands
  609.           EF_XPCMD    DSXPCOMD       Register to receive transparent commands
  610.  
  611.           INIT5       Code (AX): 5
  612.           Result                     Res1 (BX)  =   ymenumax
  613.                                      Res2 (CX)  =   iydotsm
  614.  
  615.        The INIT5  call requests  further  information  from  the  driver.
  616.        YMENUMAX specifies  the number  of pixels  assigned to  the screen
  617.        menu area.   This  normally equals the value returned by the INIT1
  618.  
  619.                                                                         7
  620.  
  621.                   ADI Graphics Display Version 2.1 - Chapter 2
  622.  
  623.  
  624.        function for  IYDOTS.   If the  screen menu has a height different
  625.        from the graphics portion of the screen, YMENUMAX should be set to
  626.        whatever that  height is.   IYDOTSM  is the  maximum vertical  dot
  627.        number of  the screen in pixels, including the text scrolling area
  628.        and the status line (total dots in y direction = IYDOTSM + 1).
  629.  
  630.        After the  INIT5 call  is  processed,  the  screen  should  be  in
  631.        graphics mode,  cleared, any  borders between logical screen areas
  632.        drawn, and ready to accept graphics mode commands.
  633.  
  634.           TERM        Code (AX): 9
  635.  
  636.        The TERM call indicates that AutoCAD is leaving the drawing editor
  637.        and that  the driver should perform any cleanup desired.  A single
  638.        screen display will always be in text mode when this call is made.
  639.  
  640.           CLEAR       Code (AX): 10
  641.           Result                     Res1 (BX)  =   repaint
  642.  
  643.        The graphics  portion of  the screen should be cleared.  The menu,
  644.        scrolling area,  and status line should not be disturbed.  If this
  645.        is not possible, set REPAINT as the sum of: 1 to redraw the status
  646.        line, 2  to redraw  the menu,  and 4  to redraw the text scrolling
  647.        area.   Otherwise, repaint  should be  0.   If  the  driver  draws
  648.        borders on  the screen  and they  are destroyed  by  clearing  the
  649.        screen, CLEAR should replace them.
  650.  
  651.           DOT         Code (AX): 11  Arg1 (BX)  =   x
  652.                                      Arg2 (CX)  =   y
  653.  
  654.        The driver  should XOR  the dot  at the location given by X and Y.
  655.        If a  multi-plane color  display, the  dot should  be XORed in all
  656.        planes.   This function  is currently used for the GRID command in
  657.        AutoCAD and may be tested by using that command.
  658.  
  659.           MOVE        Code (AX): 12  Arg1 (BX)  =   from_x
  660.                                      Arg2 (CX)  =   from_y
  661.                                      Arg3 (DX)  =   (0,drawmodes)
  662.  
  663.        The driver  should save from_x, from_y, and drawmodes for use when
  664.        drawing the next vector or filled polygon.  Each MOVE call will be
  665.        immediately followed  by a  DRAW or  FLOOD call.  If the following
  666.        call is  a DRAW,  from_x and  from_y are  the start  point of  the
  667.        vector to be drawn.  If the following call is a FLOOD, from_x will
  668.        be the  number of  vertices in the polygon, and from_y will be -2.
  669.        For either  DRAW or  FLOOD, drawmodes  is a  bit-coded field  that
  670.        specifies certain drawing modes.  Currently defined bits are:
  671.  
  672.  
  673.  
  674.        8
  675.  
  676.                   ADI Graphics Display Version 2.1 - Chapter 2
  677.  
  678.  
  679.           Name             Value   Meaning
  680.  
  681.           DR_HILITE         1      The vector/area should be highlighted.
  682.  
  683.           DR_NORDRW         2      The vector  is not  part of  a drawing
  684.                                    entity and  should not be displayed on
  685.                                    REDRAW calls.
  686.  
  687.        The DR_HILITE bit should be saved as the "highlighting status" for
  688.        the following DRAW or FLOOD call.  The DR_NORDRW bit marks vectors
  689.        that are  not part  of any  drawing entity  (for example,  the two
  690.        lines forming  a marker  blip), but  are simply  screen artifacts.
  691.        This is  provided for drivers that use the REDRAW entry, and marks
  692.        vectors that should NOT be redrawn on the next REDRAW request.
  693.  
  694.           DRAW        Code (AX): 13  Arg1 (BX)  =   to_x
  695.                                      Arg2 (CX)  =   to_y
  696.                                      Arg3 (DX)  =   color
  697.  
  698.        The driver  should draw  a vector  from the  saved FROM_X,  FROM_Y
  699.        point to  TO_X, TO_Y.   If COLOR is positive, that color should be
  700.        used (see  AutoCAD Standard Color Assignments).  If COLOR is zero,
  701.        the vector should be erased (preserving the background color if it
  702.        is something other than black).  If COLOR is -1, the vector should
  703.        be XORed  with the  background in all image planes.  If the driver
  704.        implements  highlighting,  COLOR  is  positive,  and  the  current
  705.        highlighting status  is 1 (see the MOVE command above), the vector
  706.        should be  drawn highlighted  (preferably dashed).    Otherwise  a
  707.        solid vector  should  be  drawn.    MOVE  will  always  be  called
  708.        immediately before DRAW.2
  709.  
  710.           FLOOD       Code (AX): 14  Arg1 (BX)  =   x
  711.                                      Arg2 (CX)  =   y
  712.                                      Arg3 (DX)  =   color
  713.  
  714.        The driver  should handle  the X,  Y information  depending on the
  715.        type of  hardware fill  it implements.   If the HWFILL result from
  716.        the INIT2  function call  was 0,  the FLOOD function will never be
  717.        called.   If HWFILL  was 2,  this function will be called once per
  718.        vertex of  the polygon  to be   filled, preceded and followed by a
  719.        special call  with Y  equal to  -2 and  X equal  to the  number of
  720.        vertices in  the polygon.   If  COLOR is positive, the filled area
  721.        should be that color (see AutoCAD Standard Color Assignments).  If
  722.        COLOR  is   zero,  the  area  should  be  erased  (preserving  the
  723.        background color  if it  is something  other than  black).  If the
  724.  
  725.        ____________________
  726.  
  727.        2It is  not unusual  for  some  graphics  controllers  to  draw  a
  728.        different set  of pixels  depending on the direction the vector is
  729.        drawn.   If garbage is left on the screen after erasing a polyline
  730.        or solid, you might try sorting the coordinates before drawing the
  731.        vector.
  732.                                                                         9
  733.  
  734.                   ADI Graphics Display Version 2.1 - Chapter 2
  735.  
  736.  
  737.        driver implements highlighting, COLOR is positive, and the current
  738.        highlighting status  is 1 (see the MOVE command above), the filled
  739.        area should be highlighted (usually by highlighting every 5th line
  740.        of the  fill).   MOVE will always be called immediately before the
  741.        first FLOOD call for a given polygon.
  742.  
  743.           MARK        Code (AX): 15  Arg1 (BX)  =   cur_x
  744.                                      Arg2 (CX)  =   cur_y
  745.                                      Arg3 (DX)  =   cursel
  746.           Result      Code (AX): can_do
  747.  
  748.        The device  should draw a cursor of type CURSEL.  CURSEL values of
  749.        0 and  3 specify simple full screen orthogonal crosshairs, and the
  750.        display driver  may choose to draw these with optimized code.  The
  751.        cursor should be drawn at screen coordinates CUR_X, CUR_Y.  If the
  752.        device does not implement a cursor, or cannot a draw a cursor of a
  753.        certain type,  it should  do nothing  and  return  a  code  of  0.
  754.        AutoCAD will  then draw  the cursor  itself.  If the driver itself
  755.        draws the  cursor, a  code of  1 should  be returned.   The driver
  756.        should return a code of 0 for all values of CURSEL other than 0 or
  757.        3.
  758.  
  759.           CMARK       Code (AX): 16  Arg1 (BX)  =   cur_x
  760.                                      Arg2 (CX)  =   cur_y
  761.                                      Arg3 (DX)  =   cursel
  762.           Result      Code (AX): can_do
  763.  
  764.        The device  should clear  a cursor  of type  CURSEL (see above) at
  765.        screen coordinates CUR_X, CUR_Y.  If the device does not implement
  766.        a cursor, or cannot clear a cursor of a certain type, it should do
  767.        nothing and  return a  code of  0.   AutoCAD will  then clear  the
  768.        cursor itself.   If the driver itself clears the cursor, a code of
  769.        1 should  be returned.   The  driver should return a code of 0 for
  770.        all values of CURSEL other than 0 or 3.
  771.  
  772.           CHAR        Code (AX): 20  Arg1 (BX)  =   char
  773.  
  774.        The character  specified by  CHAR should  be drawn on the graphics
  775.        screen at the current text position.  (See commands below that set
  776.        the current  text position.)   The current text position should be
  777.        moved one character to the right.
  778.  
  779.           ECHAR       Code (AX): 21
  780.  
  781.        This function  indicates the  end of  a text  string sent  by CHAR
  782.        functions.
  783.  
  784.           MHLITE      Code (AX): 22  Arg1 (BX)  =   nchars
  785.           Result                     Res1 (BX)  =   send_chars
  786.  
  787.        The driver  should highlight the menu box specified by the current
  788.        text position.   NCHARS  is the  number of  characters in the menu
  789.  
  790.        10
  791.  
  792.                   ADI Graphics Display Version 2.1 - Chapter 2
  793.  
  794.  
  795.        box.   If the  driver can  highlight the  box without  knowing the
  796.        characters within  it, it  should return  SEND_CHARS equal  to  0.
  797.        Otherwise, it should return SEND_CHARS equal to 1 and AutoCAD will
  798.        send the  contents of  the box  to the driver with NCHARS calls on
  799.        the CHAR function, followed by an ECHAR function.
  800.  
  801.           MDHLITE     Code (AX): 23  Arg1 (BX)  =   nchars
  802.           Result                     Res1 (BX)  =   send_chars
  803.  
  804.        The driver  should de-highlight  the menu  box  specified  by  the
  805.        current text  position.  NCHARS is the number of characters in the
  806.        menu box.   If the driver can de-highlight the box without knowing
  807.        the characters  within it, it should return SEND_CHARS equal to 0.
  808.        Otherwise, it should return SEND_CHARS equal to 1 and AutoCAD will
  809.        send the  contents of  the box  to the driver with NCHARS calls on
  810.        the CHAR function, followed by an ECHAR function.
  811.  
  812.           MNUCUR      Code (AX): 24  Arg1 (BX)  =   boxno
  813.                                      Arg2 (CX)  =   nboxes
  814.  
  815.        The current text cursor should be set to BOXNO on the screen (0 is
  816.        the top  box).  There are NBOXES on the screen.  This function may
  817.        be followed by CHAR functions to write into the box, or MHLITE and
  818.        MDHLITE functions to highlight or de-highlight the box.
  819.  
  820.           TPROMPT     Code (AX): 30
  821.  
  822.        The current  text cursor  should be  set to the prompt line on the
  823.        screen.  This function will be followed by CHAR functions to write
  824.        into the  prompt line.   This  function will  be used only on dual
  825.        screen displays (4 bit clear in MODES result of INIT2).
  826.  
  827.           QPLOT       Code (AX): 31
  828.           Result      Code (AX): can_do
  829.  
  830.        The driver should perform a screen dump to printer.  If the driver
  831.        cannot do this, it should do nothing and return CAN_DO equal to 0.
  832.        If the  driver did  do the  screen dump, CAN_DO should be returned
  833.        equal to 1.
  834.  
  835.           RPEN        Code (AX): 32
  836.           Result                     Res1 (BX)  =   status
  837.                                      Res2 (CX)  =   pen_x
  838.                                      Res3 (DX)  =   pen_y
  839.  
  840.        The driver should sense the position of the screen pointing device
  841.        (e.g. light  pen) and  return its  current position  in PEN_X  and
  842.        PEN_Y in terms of pixels on the graphics screen.  STATUS should be
  843.        set to  2 for  a tracking  coordinate and  3 for  a pick.   If the
  844.        driver supports  a "function  box" picks  from it  may be returned
  845.        with STATUS  equal to  4 and  PEN_X set  to the button number (the
  846.        first button  is number  0).  Function box picks will select items
  847.  
  848.                                                                        11
  849.  
  850.                   ADI Graphics Display Version 2.1 - Chapter 2
  851.  
  852.  
  853.        from the AUX1 menu.  If there is no screen pointing device, or the
  854.        device is not responding, STATUS should be returned as 0.
  855.  
  856.           GOTEXT      Code (AX): 33
  857.  
  858.        The driver  should switch  to the  text screen, and clear it.  The
  859.        cursor on the text screen should be left at the top of the screen.
  860.        Subsequent to this call, AutoCAD will use regular DOS I/O to write
  861.        to the  text screen.  This call will occur only on a single screen
  862.        system (bit 4 set in MODE result from INIT2 function).
  863.  
  864.           GOTEXTU     Code (AX): 34
  865.  
  866.        The driver  should switch  to the  text screen,  displaying hidden
  867.        screen information.   If  the  driver  maintains  its  own  hidden
  868.        screen, it  should switch  to the  text screen  and see  that  the
  869.        hidden information appears with the cursor on the text screen left
  870.        after the  hidden information.   If  the driver  asked AutoCAD  to
  871.        maintain the hidden screen (by setting HIDLINES and HIDCOLS in the
  872.        result to the INIT3 function), it should simply switch to the text
  873.        screen, clear  it, and  leave the cursor at the top.  AutoCAD will
  874.        automatically rewrite the hidden screen.  Subsequent to this call,
  875.        AutoCAD will  use regular  DOS I/O  to write  to the  text screen.
  876.        This call  will occur only on a single screen system (bit 4 set in
  877.        MODE result from INIT2 function).
  878.  
  879.           GOGRAPH     Code (AX): 35
  880.           Result                     Res1 (BX)  =   repaint
  881.  
  882.        The driver  should switch  to the  graphics screen.  Ideally, this
  883.        operation should  be non  destructive, leaving  the picture,  text
  884.        scrolling area,  status line, and screen menu exactly as they were
  885.        when the  screen was  switched to  the text screen.  If the driver
  886.        can switch  to the  graphics screen  non-destructively, it  should
  887.        return REPAINT equal to 0.  If it cannot, it should return REPAINT
  888.        as the  sum of the following codes that instruct AutoCAD to redraw
  889.        various information  on the screen: 1 to redraw the status line, 2
  890.        to redraw  the menu, 4 to redraw the text scrolling area, and 8 to
  891.        redraw the  picture in  the graphics area.  Note that if the 8 bit
  892.        is set,  causing AutoCAD to redraw the picture, the redraw process
  893.        will call  the CLEAR function.  If the CLEAR function in turn uses
  894.        REPAINT to restore the status, menu, or text scrolling area, there
  895.        is no  need to  request restoration  of these items in the REPAINT
  896.        result returned  by the GOGRAPH function.  If the driver has drawn
  897.        borders or  other information  on the screen not known to AutoCAD,
  898.        and this information was destroyed by switching to the text screen
  899.        and back, it is the responsibility of the driver to redraw it on a
  900.        GOGRAPH function.   This  function will only be called on a single
  901.        screen system (bit 4 set in MODE result from INIT2 function).
  902.  
  903.  
  904.        12
  905.  
  906.                   ADI Graphics Display Version 2.1 - Chapter 2
  907.  
  908.  
  909.           WRSPLIT     Code (AX): 36  Arg1 (BX)  =   char
  910.  
  911.        The driver  should write the character CHAR to the graphics screen
  912.        at the current text position.  If the driver implements the hidden
  913.        screen itself,  the character  should also  be saved on the hidden
  914.        screen.   If the  driver is  letting AutoCAD  maintain the  hidden
  915.        screen (by setting HIDLINES and HIDCOLS in the result of the INIT3
  916.        function), the driver need only draw the character on the graphics
  917.        screen; AutoCAD  will take  care of  saving it.   The current text
  918.        position should be moved one character to the right.
  919.  
  920.           MODELINE    Code (AX): 37  Arg1 (BX)  =   length
  921.                                      Arg2 (CX)  =   color
  922.  
  923.        The driver  should set  the current  text position to the start of
  924.        the mode  status line.   LENGTH specifies the number of characters
  925.        that will  be sent  via the CHAR function following this function.
  926.        An ECHAR  function will terminate the string.  The current drawing
  927.        color (color  new entities  will appear  in, however  derived)  is
  928.        passed in  COLOR so  that the device can, if it chooses, represent
  929.        this on the mode status line.
  930.  
  931.           COORDLINE   Code (AX): 38  Arg1 (BX)  =   length
  932.  
  933.        The driver  should set  the current  text position to the start of
  934.        the coordinate  status line  (usually  one  more  than  MODELINL).
  935.        LENGTH specifies  the number  of characters  that will be sent via
  936.        the CHAR function following this function.  An ECHAR function will
  937.        terminate the string.
  938.  
  939.           SYNC        Code (AX): 50
  940.  
  941.        Informs drivers  with local display buffers to force those buffers
  942.        to be  drawn,  bringing  the  picture  into  sync  with  AutoCAD's
  943.        internal state.   For example, this can be called before digitizer
  944.        samples are  taken to  ensure that  the entire  picture is  on the
  945.        screen for the user to pick from.
  946.  
  947.           REDRAW      Code (AX): 51  Arg1 (BX)  =   clear flag
  948.           Result      Code (AX):     0 - Unable to redraw complete picture
  949.                                      1 - Complete picture redrawn
  950.  
  951.           Arg1 = 0 - Perform a REDRAW
  952.  
  953.        When a  redraw of the picture is necessary, AutoCAD will call this
  954.        entry with  an argument  of 0  to get  it to  attempt  to  do  the
  955.        redrawing of  vectors.   AutoCAD will  still call CLEAR before and
  956.        will draw  grid dots,  etc. afterwards.   If  this returns  a ZERO
  957.        value, AutoCAD  will assume that the driver has declined to do the
  958.        job, and will redraw the image vector by vector as usual.
  959.  
  960.                                                                        13
  961.  
  962.                   ADI Graphics Display Version 2.1 - Chapter 2
  963.  
  964.  
  965.           Arg1 = 1 - Flush display buffer
  966.  
  967.        When the  current contents  of any  display buffer  are no  longer
  968.        valid, AutoCAD  will call  this entry  with argument 1 to indicate
  969.        that the  vector space  should be  cleared.   No return  status is
  970.        necessary.
  971.  
  972.           DSCOMAND    Code (AX): 52  Arg1 (BX)  =   string length
  973.                                      Arg2 (CX)  =   string OFFSET
  974.                                      Arg3 (DX)  =   string SEGMENT
  975.  
  976.           Result      Code (AX):     0 - Command not recognized
  977.                                      1 - Command recognized and processed
  978.  
  979.        The driver  has (in  the INIT4  function)  requested  that  it  be
  980.        allowed to  examine all  input commands that are not recognized by
  981.        AutoCAD.     The  command   string  location   is  passed   as   a
  982.        SEGMENT/OFFSET pair  in DX/CX,  with the string length in BX.  The
  983.        command string  is terminated  by a  zero  byte  in  the  usual  C
  984.        fashion.  If the driver returns 0 in AX, AutoCAD will proceed with
  985.        its unknown  command handling;  if the driver returns a 1, AutoCAD
  986.        will assume  that the  string has been recognized and processed by
  987.        the driver,  and will  behave as  if it  were  any  valid  AutoCAD
  988.        command (e.g. a null line will repeat the command).
  989.  
  990.           DSXPCOMD    Code (AX) 53   Arg1 (BX): command character
  991.  
  992.           Result      Code (AX)      0 - Command not recognized
  993.                                      1 - Command recognized and processed
  994.  
  995.        The driver  has (in  the INIT4  function)  requested  that  it  be
  996.        notified  when   a  special  transparent  display  driver  command
  997.        character is entered.  Currently, there is only one such character
  998.        - Ctrl-L  (0C hexadecimal).   The character is supplied in BX.  If
  999.        the driver  returns 0 in AX, AutoCAD will proceed with its unknown
  1000.        character handling; if the driver returns a 1, AutoCAD will assume
  1001.        that the  character has  been  recognized  and  processed  by  the
  1002.        driver.   The transparent  control character may be entered AT ANY
  1003.        TIME by the user, and will be immediately passed to the driver.
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.        14
  1015.  
  1016.                   ADI Graphics Display Version 2.1 - Chapter 2
  1017.  
  1018.  
  1019.        2.6 AutoCAD Standard Colors
  1020.  
  1021.        Whenever a  color value is passed from AutoCAD to the ADI Graphics
  1022.        Display driver, the following mapping should be used:
  1023.  
  1024.                 0     Background (erase)
  1025.                 1     red
  1026.                 2     yellow
  1027.                 3     green
  1028.                 4     cyan
  1029.                 5     blue
  1030.                 6     magenta
  1031.                 7     white
  1032.              8-15     usually intensified version of above
  1033.                       (for RGBI type devices)
  1034.  
  1035.        For displays  that use  256 colors,  the  hue  resulting  from  an
  1036.        AutoCAD color  10-249 will  be determined by its first two digits,
  1037.        and the saturation and value from the last digit, as follows:
  1038.  
  1039.           Hues:
  1040.  
  1041.                10     Red
  1042.                50     Yellow
  1043.                90     Green
  1044.               130     Cyan
  1045.               170     Blue
  1046.               210     Magenta
  1047.  
  1048.        Between each  of these  are three intermediate hues, e.g., between
  1049.        red and yellow, we have:
  1050.  
  1051.                20     reddish orange
  1052.                30     orange
  1053.                40     yellowish orange
  1054.  
  1055.        To each  hue number,  0, 2,  4, 6,  or 8  can be  added to  give a
  1056.        different "value",  or brightness,  with 0 the brightest and 8 the
  1057.        weakest.   Finally, 1  can be added to produce a "half-saturated",
  1058.        or pastel, color.  For example, color 18 is the dimmest red and 10
  1059.        the brightest  red, 19  is the  dimmest pink  and 11 the brightest
  1060.        pink.  Colors 8 and 9 are up for grabs; typically various greys or
  1061.        sometimes black.
  1062.  
  1063.        When AutoCAD  asks the  driver to draw in a color that matches the
  1064.        background color, then white should be used (unless the background
  1065.        color is white, in which case black should be used).
  1066.  
  1067.        Included on  the ADI  diskette is  the file CHROMA.DWG, an AutoCAD
  1068.        drawing that  shows all  colors 1-255.  You should use this sample
  1069.        drawing for debugging your driver.
  1070.                                                                        15
  1071.  
  1072.                   ADI Graphics Display Version 2.1 - Chapter 2
  1073.  
  1074.  
  1075.        2.7 ADI Graphics Display Test Procedures
  1076.  
  1077.        Included in  the ADI Development Kit is a set of files for testing
  1078.        graphics display  drivers.   These files  use  the  AutoLISP  LISP
  1079.        interpreter built into AutoCAD to automate the testing of graphics
  1080.        display drivers.   Type  (load"DSTEST") at  the  AutoCAD  COMMAND:
  1081.        prompt, or  rename DSTEST.LSP  to ACAD.LSP  to  have  the  program
  1082.        loaded automatically  when AutoCAD  is started.   Type "single" or
  1083.        "dual" at the AutoCAD prompt to test those configurations.  If you
  1084.        wish, you  may also  wish to  perform the  manual test  procedures
  1085.        outlined below.
  1086.  
  1087.        Manual test procedures follow:
  1088.  
  1089.        1) Set up  the machine  to be  tested with  the display  board, an
  1090.           appropriate monitor, and a digitizer.
  1091.  
  1092.        2) Copy the  AutoCAD release  into a  test directory.    Configure
  1093.           AutoCAD for the board, monitor, and digitizer you are using.
  1094.  
  1095.        3) Start a new drawing and perform the following tests.
  1096.  
  1097.           a) Draw a  circle.   DRAG the  placement of  the circle  on the
  1098.              screen.   Garbage from  circles drawn by dragging should not
  1099.              appear.   ERASE the  circle.  For ADE3, the circle should be
  1100.              highlighted.   Toggle the  screen from graphics to text, and
  1101.              back to  graphics, with the flipscreen key.  Garbage (or the
  1102.              circle)  should   NOT  appear  and  the  border  should  not
  1103.              disappear.
  1104.  
  1105.           b) Draw a box around the edges of the graphics area, overlaying
  1106.              the borders.   (This  is most easily done by starting a line
  1107.              at a  corner and  then continuing the "to points" at each of
  1108.              the remaining  corners.)  ERASE the box.  The borders of the
  1109.              graphics area should not disappear.
  1110.  
  1111.           c) Configure the  display with  MENU on and COMMAND PROMPT AREA
  1112.              off.   Scroll through the menu with the pointing device from
  1113.              top to  bottom and  back to  the top.  The Menu items should
  1114.              not scroll  (move).   Scroll through the menu from bottom to
  1115.              top and  back to  the bottom.   Again, the menu items should
  1116.              not scroll.
  1117.  
  1118.           d) Configure the  display with  COMMAND PROMPT  AREA on.  Enter
  1119.              the drawing  editor using  a large  drawing (e.g.   CHROMA).
  1120.              Point to  the last  item in  the menu area with the pointing
  1121.              device.   Type in REGEN.  Enter CONTROL C while the regen is
  1122.              in progress.   After  the REGEN  is canceled,  enter several
  1123.              more commands.  The command text area should not scroll into
  1124.              the drawing area.
  1125.  
  1126.        16
  1127.  
  1128.                   ADI Graphics Display Version 2.1 - Chapter 2
  1129.  
  1130.  
  1131.           e) For  COLOR  display  drivers,  check  that  the  colors  are
  1132.              correct.  Also, if colors for graphics background, menu text
  1133.              and prompt  text are  configurable,  check  that  the  color
  1134.              assignments really work.
  1135.  
  1136.           f) For COLOR display drivers, turn AXIS on, draw something with
  1137.              any color  other than  that used  for the  axis,  erase  the
  1138.              object you  drew and  flip screen  from graphics to text and
  1139.              back again.  The axis should NOT be drawn with the color you
  1140.              drew the object in.  Also, the border should NOT disappear.
  1141.  
  1142.           g) Draw a  wide polyline.   MOVE  the polyline.  Garbage should
  1143.              not appear  or be  left behind  on the  screen.   ERASE  the
  1144.              polyline.   There should  be no  garbage left on the screen.
  1145.              Perform the same steps with a solid.3
  1146.  
  1147.        4) The next  group of  procedures involve  configuring the  STATUS
  1148.           LINE, COMMAND PROMPT AREA, and MENU AREA in all possible on/off
  1149.           combinations and performing tests with each configuration.  Use
  1150.           the drawing  DSTEST.DWG in the remainder of the tests.  Use the
  1151.           accompanying chart  to track your progress.
  1152.  
  1153.           a) Go to  the AutoCAD  configuration  menu  and  configure  the
  1154.              STATUS LINE, COMMAND PROMPT AREA, and MENU AREA according to
  1155.              the appropriate step in the chart.
  1156.  
  1157.           b) Enter the drawing editor using DSTEST.DWG.
  1158.  
  1159.           c) Draw a  box around  the limits  of the  display  (as  in  3b
  1160.              above).   Make sure  that  the  edges  of  the  display  are
  1161.              accessible.
  1162.  
  1163.           d) With the  STATUS LINE  configured off,  there should  be  no
  1164.              STATUS LINE  at the  top of  the screen.  Conversely, if the
  1165.              STATUS LINE   was  configured on,  it should  be  there  and
  1166.              should contain  the correct  information on layer, modes and
  1167.              coordinates.
  1168.  
  1169.           e) With the COMMAND PROMPT AREA configured off, there should be
  1170.              no command  prompt at  the bottom  of the  screen.   If  the
  1171.              COMMAND PROMPT AREA  was configured on, there should be text
  1172.              lines usable at the bottom of the screen (3 lines for single
  1173.              screen, 1  line for  dual screen)  for entering  commands or
  1174.              data.
  1175.  
  1176.           f) With the  MENU AREA  configured off,  there should  not be a
  1177.              MENU AREA  on the  right  hand  side  of  the  screen.    If
  1178.              configured on,  the complete menu area should be accessible.
  1179.              Scroll through  the MENU  AREA from  top to  bottom and from
  1180.  
  1181.        ____________________
  1182.  
  1183.        3See footnote to DRAW function above.
  1184.                                                                        17
  1185.  
  1186.                   ADI Graphics Display Version 2.1 - Chapter 2
  1187.  
  1188.  
  1189.              bottom to top.  You should be able to access from the top of
  1190.              the menu  to the  bottom.   Make sure  that picking an entry
  1191.              works.
  1192.  
  1193.           g) Flip screen  from graphics  to text  and back.   None of the
  1194.              lines drawn around the display should disappear.
  1195.  
  1196.           h) Draw a  unit circle  in the  middle of  the  screen.    Zoom
  1197.              extents.   The border  should not clip the circle at the top
  1198.              of the  screen.   Erase the  circle.  The borders at the top
  1199.              and bottom  edges of  the screen  should not be erased.  Now
  1200.              zoom out  and draw  another unit  circle to the right of the
  1201.              first one  such that  the distance  between the  centers  is
  1202.              greater than  the diameter.   Zoom  extents.     The  border
  1203.              should not  clip the  circles at  the sides  of the  screen.
  1204.              Erase both  circles.   This should  not erase the borders at
  1205.              the sides of the screen.
  1206.  
  1207.           i) Go to  step 4a and repeat the above procedures with the next
  1208.              configuration.
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.        18
  1241.  
  1242.                   ADI Graphics Display Version 2.1 - Chapter 2
  1243.  
  1244.  
  1245.  
  1246.  
  1247.                               ADI GRAPHICS DISPLAY
  1248.                                    TEST CHART
  1249.  
  1250.  
  1251.                         STATUS    PROMPT     MENU        PASS/FAIL
  1252.                          LINE      AREA      AREA
  1253.              ___________________________________________________________
  1254.  
  1255.  
  1256.              Config 1    OFF       OFF       OFF           ______
  1257.  
  1258.              Config 2    OFF       OFF        ON           ______
  1259.  
  1260.              Config 3    OFF        ON       OFF           ______
  1261.  
  1262.              Config 4    OFF        ON        ON           ______
  1263.  
  1264.              Config 5     ON       OFF       OFF           ______
  1265.  
  1266.              Config 6     ON       OFF        ON           ______
  1267.  
  1268.              Config 7     ON        ON       OFF           ______
  1269.  
  1270.              Config 8     ON        ON        ON           ______
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.                                                                        19
  1297.  
  1298.                   ADI Graphics Display Version 2.1 - Chapter 2
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.        20
  1351.  
  1352.        __________________________________________________________________
  1353.  
  1354.  
  1355.                                    Chapter 3
  1356.  
  1357.  
  1358.                         THE ADI DIGITIZER SPECIFICATION
  1359.  
  1360.        __________________________________________________________________
  1361.  
  1362.  
  1363.        The following  describes, in  detail, the  interface specification
  1364.        for ADI digitizer drivers.
  1365.  
  1366.        3.1 The ADI Digitizer
  1367.  
  1368.        The ADI  Driver Development Kit contains the information needed to
  1369.        create an  ADI digitizer  driver for  use with  Autodesk  software
  1370.        products such  as AutoCAD  and AutoSketch.  A demonstration driver
  1371.        for the  Microsoft Mouse,  DGDEMO.C, is  included.    This  driver
  1372.        requires IWAIT.ASM,  ADI.H (functions  common to all ADI drivers),
  1373.        and DGADI.H (functions for ADI digitizer drivers).
  1374.  
  1375.        3.2 Configuration
  1376.  
  1377.        ADI  Digitizer   drivers  may   be  used  with  both  AutoCAD  and
  1378.        AutoSketch.
  1379.  
  1380.        When the  AutoCAD user specifies the ADI Digitizer driver from the
  1381.        AutoCAD Configuration  Menu, the only configuration question asked
  1382.        is:
  1383.  
  1384.           Hexadecimal interrupt code (INT 0XXh) <79>:
  1385.  
  1386.        The user  should respond  with the interrupt location at which the
  1387.        digitizer driver  is installed.   You  need to  inform the user in
  1388.        your documentation  which interrupt  to use.   The  default on new
  1389.        installations is 79h.    AutoCAD  may  be  configured  to   use  a 
  1390.        different interrupt vector.  AutoSketch assumes the  ADI digitizer
  1391.        is installed at interrupt 79 and may not be changed.
  1392.  
  1393.        No other  configuration questions are required.  The developer may
  1394.        choose to  include any  desired configuration  questions when that
  1395.        driver is installed, or may supply them in AUTOEXEC.BAT, etc.
  1396.  
  1397.        3.3 The ADI Digitizer Interface
  1398.  
  1399.        The generic  driver code simply makes calls to an installed driver
  1400.        and passes its responses back to the program.  The driver is not a
  1401.        true MS-DOS device driver (although it may be implemented as one),
  1402.        but rather  a program that "terminates and remains resident" after
  1403.        patching a  call to  itself into  an interrupt vector by which the
  1404.        program calls it.
  1405.  
  1406.                                                                        21
  1407.  
  1408.                      ADI Digitizer Version 2.1 - Chapter 3
  1409.  
  1410.  
  1411.        Information is  passed back  and forth between the program and the
  1412.        driver through  the registers AX, BX, CX, and DX.  The driver code
  1413.        must preserve all segment registers and the registers SI and DI.
  1414.  
  1415.           Commands to driver         Code (AX)
  1416.           Initialize                 1        BX = Interface version (1)
  1417.           Terminate                  2
  1418.           Probe                      3
  1419.  
  1420.        When the  drawing editor is initialized, the driver will be called
  1421.        with AX  equal to  1 (initialize).   BX contains a code indicating
  1422.        the revision  number of  the driver  interface  (to  allow  upward
  1423.        compatibility).  The current version of the driver passes 1 in BX.
  1424.        The installed  driver should  perform whatever  initialization  it
  1425.        wishes and  return with  a status  in AX.   If  the initialization
  1426.        failed,  the  driver  should  return  0  in  AX,  otherwise  1  if
  1427.        everything went  well.    If  1  is  returned  in  AX,  indicating
  1428.        successful initialization,  BX  is  expected  to  contain  a  code
  1429.        indicating the  type of  the pointing  device.   If BX  is 0,  the
  1430.        device is  configured as  a relative  pointing device  such  as  a
  1431.        mouse; tablet menus and tablet mode will be disabled.  If BX is 1,
  1432.        the device  is configured  as  a  tablet  and  all  tablet-related
  1433.        commands will  be turned  on.   In addition,  CX  is  expected  to
  1434.        contain a  code indicating  whether the  pointer sends  continuous
  1435.        samples or pauses between samples.  If the pointer always responds
  1436.        with a  sample, or  if pauses  are meaningful  (for example,  they
  1437.        indicate the  cursor has been removed from the tablet surface), CX
  1438.        should be  set to 0.  If the device occasionally returns no sample
  1439.        because of  its inherent  properties (for  example, a device which
  1440.        only reports  changes in  coordinates), CX  should be  set  to  1.
  1441.        Setting CX incorrectly can cause the crosshairs to blink.
  1442.  
  1443.        If the driver returns zero, the message:
  1444.  
  1445.           Could not initialize pointer driver.
  1446.  
  1447.        will be issued and the device disabled.  Before calling the driver
  1448.        to initialize  it, the program driver tests whether the configured
  1449.        interrupt vector  is nonzero.  If it is zero, indicating no driver
  1450.        is installed,  and hence  that trying  to call  it would crash the
  1451.        machine, the message:
  1452.  
  1453.           ** No driver is installed for interrupt vector 0XX **
  1454.  
  1455.        will be issued and the driver disabled.
  1456.  
  1457.        As the  drawing editor  runs, whenever  the program asks for input
  1458.        from the  digitizer, the installed driver will be called with 3 in
  1459.        AX (Probe).   The  driver should respond with one of the following
  1460.        status codes in AX, with additional arguments as indicated.
  1461.  
  1462.        22
  1463.  
  1464.                      ADI Digitizer Version 2.1 - Chapter 3
  1465.  
  1466.  
  1467.  
  1468.           Response         AX        BX        CX        DX
  1469.  
  1470.           Nothing          0
  1471.           Tracking point   2         X-coord   Y-coord
  1472.           Picked point     3         X-coord   Y-coord
  1473.           Button pick      4         Button #
  1474.           Button + coords  5         Button #  X-coord   Y-coord
  1475.  
  1476.        AX =  0 indicates the pointer had nothing to report.  No action is
  1477.        taken by  the program.  This code may be returned when waiting for
  1478.        a button  to be  released following  a selection.   (Note that the
  1479.        program  driver   does  not   perform  this  function--it  is  the
  1480.        responsibility of  the installed  driver, as  is any debouncing of
  1481.        buttons which may be required).
  1482.  
  1483.        AX =  2 indicates  a "tracking"  coordinate pair is returned in BX
  1484.        and CX.   The X coordinate, in the range from 0 to 20480 inclusive
  1485.        is returned  in BX,  and the Y coordinate in the same range in CX.
  1486.        This is  how coordinates  are returned when the pick button is not
  1487.        pressed.  The program will track with the screen or menu cursor.
  1488.  
  1489.        AX =  3 indicates  a picked  coordinate pair is returned in BX and
  1490.        CX.   The X  coordinate, in the range from 0 to 20480 inclusive is
  1491.        returned in  BX, and  the Y  coordinate in  the same  range in CX.
  1492.        This code is used to return the coordinates when the "pick" button
  1493.        is pressed.
  1494.  
  1495.        AX =  4 indicates  a button  has been  pressed, which  generates a
  1496.        button menu  pick.   The button number is returned in BX, with the
  1497.        first button indicated by 0, the second by 1, and so on.
  1498.  
  1499.        AX =  5 indicates  a button  has been  pressed, which  generates a
  1500.        button menu  pick, and  that the driver can return the coordinates
  1501.        of the  pointer at the time of the button pick.  The button number
  1502.        is returned  in BX, the X coordinate (0 to 20480) in CX, and the Y
  1503.        coordinate in  DX.   Devices  which  return  the  current  pointer
  1504.        position with  button menu picks should call function 5 and return
  1505.        the coordinates.   Devices  which lack  this capability should use
  1506.        function 4 described above.
  1507.  
  1508.        If any  value other  than those given above is returned in AX, the
  1509.        message:
  1510.  
  1511.           ** Pointer driver returned illegal code X.  Pointer disabled **
  1512.  
  1513.        will be issued and the pointer disabled.
  1514.  
  1515.        When the  drawing editor  returns to  the main menu, the installed
  1516.        driver will  be called with 2 in AX.  This instructs the driver to
  1517.        terminate.
  1518.                                                                        23
  1519.  
  1520.  
  1521.                      ADI Digitizer Version 2.1 - Chapter 3
  1522.  
  1523.  
  1524.        Note:
  1525.  
  1526.        The point  coordinates returned by the digitizer driver should lie
  1527.        in the range 0 to 20480 with (0,0) at the lower left corner of the
  1528.        tablet and  (20480,20480) at  the  upper  right.    Even  relative
  1529.        pointing devices,  such as  mice, must return absolute coordinates
  1530.        in the  range 0  to 20480.   If  a digitizer  tablet has differing
  1531.        height and  width, the  full range of the SMALLER dimension should
  1532.        be scaled  to 0  to 20480, with the larger dimension's coordinates
  1533.        using the  same scale.   This  scheme will  result in  the  larger
  1534.        dimension's coordinates  exceeding 20480,  though they must remain
  1535.        less than 32768.  If Tablet Mode is to function properly, vertical
  1536.        and horizontal digitizer coordinates must represent equal physical
  1537.        distances.
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.        24
  1575.  
  1576.                      ADI Digitizer Version 2.1 - Chapter 3
  1577.  
  1578.  
  1579.        3.4 ADI Digitizer Test Procedures
  1580.  
  1581.        These test  procedures are for use with AutoCAD.  If you intend to
  1582.        use your  ADI digitizer  driver with  AutoSketch, we  suggest that
  1583.        create a  simple drawing with AutoSketch and edit it using all the
  1584.        options in  the Change  menu.  Be sure that you are able to access
  1585.        the entire drawing area and that picking works correctly.
  1586.  
  1587.        1) Set-up machine  for the  digitizer you  are testing.  Cable the
  1588.           digitizer  as   documented  in  the  AutoCAD  Drafting  Package
  1589.           Installation/Performance Guide.
  1590.  
  1591.        2) Configure AutoCAD for the digitizer.
  1592.  
  1593.        3) Start a  new drawing.   Cross  hairs should  appear  on  screen
  1594.           immediately after  bringing up  a the  drawing.  Check that the
  1595.           pointing device  moves cross-hairs  smoothly across  the screen
  1596.           and that  the cross-hairs  can be moved over the entire drawing
  1597.           screen.   Moving the  pointing device  from the  bottom of  the
  1598.           digitizer pointing  area to the top should move the cross-hairs
  1599.           from the  bottom to the top of the screen.  Moving the pointing
  1600.           device from  the extreme left of the digitizer pointing area to
  1601.           the right  should move  the cross-hairs  from the  left of  the
  1602.           screen to  the right  (into the  menu area  if the menu area is
  1603.           configured on).
  1604.  
  1605.        4) Check that  the "button" options for each supported puck, mouse
  1606.           or stylus work as documented in the Installation Guide.
  1607.  
  1608.           The following  table gives  the function  representation of the
  1609.           Menu item buttons in the standard AutoCAD menu:
  1610.  
  1611.           Menu item button                Function
  1612.           ------------------------------------------------------------
  1613.           1 = ; (Semicolon)               <Return>
  1614.           2 = Ctrl C;Redraw               Redraw drawing in screen area
  1615.           3 = Ctrl C                      *Cancel*
  1616.           4 = Ctrl B                      Snap mode on/off
  1617.           5 = Ctrl O                      Ortho mode on/off
  1618.           6 = Ctrl G                      Grid on/off
  1619.           7 = Ctrl D                      Coordinate Display
  1620.           8 = Ctrl E                      Isometric Plane
  1621.           9 = Ctrl T                      Tablet mode on/off
  1622.           10-16                           Not set
  1623.  
  1624.           Note:   On the  12 and 16-button cursors, the "*" button can be
  1625.           used to  select menu  items, but  only if  the tablet's  Cursor
  1626.           Function Disable sequence "**0" has been executed.  See page 4-
  1627.           6 of the Calcomp 9000 Series Digitizer Operator's Manual 50090-
  1628.           1.
  1629.  
  1630.                                                                        25
  1631.  
  1632.                      ADI Digitizer Version 2.1 - Chapter 3
  1633.  
  1634.  
  1635.           Note:   The black  button on  the back of the Kraft Joystick or
  1636.           the right  button on  the pad may be used to select slow motion
  1637.           mode, or to invoke the first item from the button menu.
  1638.  
  1639.        The following  procedure steps  5 and  6 test  commands with modes
  1640.        that operate outside the "normal" operating environment of AutoCAD
  1641.        commands and  are specific  to the digitizer and therefore singled
  1642.        out for  testing.  For definitions of these commands, consult your
  1643.        AutoCAD Drafting Package Reference Manual.
  1644.  
  1645.        5) Test the  pointing device  in SKETCH mode.  The normal "button"
  1646.           menu cannot be used while a SKETCH command is in progress.
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.        26
  1685.  
  1686.                      ADI Digitizer Version 2.1 - Chapter 3
  1687.  
  1688.  
  1689.           The following  is a list of SKETCH subcommands, and the pointer
  1690.           buttons which correspond to them:
  1691.  
  1692.           Command Character  Pointer Buttons        Function
  1693.           --------------------------------------------------------------
  1694.           P                       "Pick"            Raise/Lower pen
  1695.           . (period)                1               Line to point
  1696.           R                         2               Record lines
  1697.           X,Space,<Return>          3               Record lines and exit
  1698.           Q,Ctrl C                  4               Discard lines and exit
  1699.           E                         5               Erase
  1700.           C                         6               Connect
  1701.  
  1702.        6) If testing a Digitizer Tablet:
  1703.  
  1704.           a) Configure the tablet for four Menu areas (Maximum supported)
  1705.              with the  standard TABLET  TEST SHEET  and check to see that
  1706.              all menus  are accessible with pointing device by calling up
  1707.              the digitizer test menu "DGTEST".
  1708.  
  1709.           a) Calibrate tablet  to area  with known  dimensions and  check
  1710.              various  points   (Tablet  mode  on)  for  accuracy.    When
  1711.              calibrating the  Tablet, choose  two points that require the
  1712.              command to  perform coordinate  calculations more  difficult
  1713.              than those  required by picking the origin and another point
  1714.              on either the X or Y axis.
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.                                                                        27
  1741.  
  1742.                      ADI Digitizer Version 2.1 - Chapter 3
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.    28
  1794.  
  1795.  
  1796.        __________________________________________________________________
  1797.  
  1798.  
  1799.                                    Chapter 4
  1800.  
  1801.  
  1802.                          THE ADI PLOTTER SPECIFICATION
  1803.  
  1804.        __________________________________________________________________
  1805.  
  1806.  
  1807.        The following  describes, in  detail, the  interface specification
  1808.        for ADI Plotter drivers.
  1809.  
  1810.        4.1 The ADI Plotter Kit
  1811.  
  1812.        The ADI  Development Kit  allows users  to  interface  AutoCAD  to
  1813.        plotters and  other vector-oriented devices that Autodesk does not
  1814.        directly support.   The  driver is fully configurable and offers a
  1815.        variety of different output formats.
  1816.  
  1817.        The output  from the  AutoCAD ADI  driver may  be sent to an ASCII
  1818.        file,  a  binary  file,  or  configured  to  communicate  with  an
  1819.        installed INT driver.
  1820.  
  1821.        4.2 Configuration
  1822.  
  1823.        Because the  driver is  indeed generic, the process of configuring
  1824.        it is more complex than that required by most other plotters.  All
  1825.        the hardware information provided by a conventional driver must be
  1826.        supplied by  the user  when configuring this driver.  As a result,
  1827.        the dialogue  is extended.   First,  the driver's output format is
  1828.        selected.  The following prompt is issued:
  1829.  
  1830.           Select output format:
  1831.  
  1832.           0. ASCII file
  1833.           1. Binary file
  1834.           2. AutoCAD DXB file
  1835.           3. Installed INT driver
  1836.  
  1837.           Output format, 0 to 3 <0>:
  1838.  
  1839.        The ASCII  and binary  file formats  will be described later.  The
  1840.        DXB file  format is  described in  the  AutoCAD  Drafting  Package
  1841.        Reference Manual.   The generic driver can also send commands to a
  1842.        resident driver  via an  INT call.  If this option is selected via
  1843.        option 3, the additional question:
  1844.  
  1845.           Hexadecimal interrupt code (INT 0XXh) <78>:
  1846.  
  1847.        will be  issued.   The response selects the interrupt vector to be
  1848.        used to  communicate with the plotter driver.  The default is 78h.
  1849.        Any vector  from 1 to 0FFh is permissible.  If an invalid reply is
  1850.        entered, the message:
  1851.                                                                        29
  1852.  
  1853.                       ADI Plotter Version 2.1 - Chapter 4
  1854.  
  1855.  
  1856.           ** Interrupt number must be between 1 and 0FF
  1857.  
  1858.        is given and the prompt reissued.
  1859.  
  1860.        Following the  output format dialog, the user is asked whether the
  1861.        plotter is multi-pen:
  1862.  
  1863.           Does the plotter have multiple pens? <N>
  1864.  
  1865.        If this is answered yes, the user is asked:
  1866.  
  1867.           How many pens does it have, 2 to 127 <2>:
  1868.  
  1869.        Next, information  on plotter-implemented line styles is requested
  1870.        with the questions:
  1871.  
  1872.           Does the plotter have multiple dashed line styles? <N>, and,
  1873.           How many line styles are there, 2 to 127 <5>:
  1874.  
  1875.        If the  plotter provides  multiple pen speeds, the user may define
  1876.        them with the questions:
  1877.  
  1878.           Is the plotter variable speed? <N>, and,
  1879.           What is the numeric code for the fastest speed, 1 to 127 <10>
  1880.  
  1881.        These questions  supply information  which is normally provided by
  1882.        the hardware  definition of a plotter within a driver.  It is used
  1883.        to enable  features in  the plot  setup  process  and  to  provide
  1884.        rudimentary range checking of user specifications.
  1885.  
  1886.        Next the  maximum plot  size and  plotter step size are specified.
  1887.        These arguments  may be specified either in inches or millimeters.
  1888.        The units are selected by the prompt:
  1889.  
  1890.           Next you  will specify  the maximum  plot size  the plotter can
  1891.           make, and the step size of  the plotter.  You may specify these
  1892.           either in millimeters or inches.  The next question selects the
  1893.           units.
  1894.  
  1895.           Specify plot size in millimeters? <N>
  1896.  
  1897.        If the  answer is  the default,  "no," the prompts that follow and
  1898.        their responses  will refer to inches, otherwise millimeters.  The
  1899.        examples given below assume inches were selected.
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.        30
  1909.  
  1910.                       ADI Plotter Version 2.1 - Chapter 4
  1911.  
  1912.  
  1913.           Maximum horizontal (X) plot size in inches? <11.0>
  1914.           Plotter  steps  per  inch  in  the  horizontal  (X)  direction:
  1915.           <1000.0>
  1916.  
  1917.           Maximum vertical (Y) plot size in inches? <8.5>
  1918.           Plotter steps per inch in the vertical (Y) direction: <1000.0>
  1919.  
  1920.        These parameters  are floating  point numbers  that  are  used  to
  1921.        compute the  plotter size  in plotter  steps.  The calculated step
  1922.        count may  not exceed  65535.   If the specifications given exceed
  1923.        the limit,  the following message will appear (after the steps per
  1924.        inch are specified):
  1925.  
  1926.           ** Error:  Plot size multiplied by steps per inch cannot exceed
  1927.           65535.  Specifications resulted in ?????.
  1928.  
  1929.        The question  marks in  the prompt  are replaced by the step count
  1930.        the user  tried to  configure.  After this error message, the pair
  1931.        of prompts for plot size and steps per unit are reissued.
  1932.  
  1933.        Once the  driver-specific configuration  is completed, the regular
  1934.        plotter configuration  is performed.   The  generic plotter driver
  1935.        remembers all  its configuration  options  and  supplies  them  as
  1936.        defaults on  subsequent configurations.  The defaults given in the
  1937.        prompts above  are those  assumed on  a new  configuration of  the
  1938.        driver.
  1939.  
  1940.        4.3 Using the Driver
  1941.  
  1942.        If ASCII,  binary, or  DXB output  format has  been selected,  the
  1943.        program will prompt for a file name following all the runtime plot
  1944.        configuration dialogue:
  1945.  
  1946.           Enter file name for plot:
  1947.  
  1948.        The user  should reply  with a  file name  for the plot data.  The
  1949.        name may  be entered  with a  file type,  if desired.   If none is
  1950.        specified, ".plt"  (or ".dxb"  in the case of output format option
  1951.        2) will be used.  If the file cannot be opened, the message:
  1952.  
  1953.           Cannot open this file.  Try another name? <N>
  1954.  
  1955.        will appear.  If answered affirmatively, the file name prompt will
  1956.        reappear; otherwise the plot will be canceled.
  1957.  
  1958.        4.4 Output Format
  1959.  
  1960.        Regardless of the output format and method, plot data is expressed
  1961.        in a  single representation.  Each plot command consists of a type
  1962.        code, possibly  followed by  arguments.  The following table gives
  1963.        the plot codes and their arguments:
  1964.  
  1965.                                                                         31
  1966.  
  1967.                       ADI Plotter Version 2.1 - Chapter 4
  1968.  
  1969.  
  1970.           Function       Code      Type      Argument 1    Argument 2
  1971.  
  1972.           Begin plot     1         B         File level
  1973.           End plot       2         A
  1974.           Move           3         C         X coordinate  Y coordinate
  1975.           Draw           4         C         X coordinate  Y coordinate
  1976.           New pen        5         B         Pen number
  1977.           Select speed   6         B         Speed code
  1978.           Set line type  7         B         Line type
  1979.           Pen change     8         A
  1980.           Abort plot     9         A
  1981.  
  1982.        The "type"  field in the above table specifies how the information
  1983.        is represented  in the  file or  passed to  the  driver.    Before
  1984.        discussing the  representation, let  us examine  the various  plot
  1985.        commands and the meaning of their arguments.
  1986.  
  1987.        The first code generated for any plot is the BEGIN PLOT code.  Its
  1988.        argument is  a number  which specifies  the version  of  the  plot
  1989.        command file  which follows.   Plots  generated by this version of
  1990.        the driver will have a file level of 1.
  1991.  
  1992.        The PEN  CHANGE code  is generated  before every pen change at the
  1993.        start of  a pass  over the  vectors.   It allows  the  plotter  to
  1994.        prepare for a possible manual pen change (for example, raising the
  1995.        pen and  moving it  to the middle of the carriage).  It is not the
  1996.        actual change pen command, which is the NEW PEN code.  Note that a
  1997.        PEN CHANGE  command will  always be  generated at  the start  of a
  1998.        plot.
  1999.  
  2000.        The NEW  PEN code  is the actual command that selects a pen.  This
  2001.        code is  followed by  an argument  which specifies the pen number.
  2002.        See the Plotting chapter of the AutoCAD Drafting Package Reference
  2003.        Manual for  information on  how AutoCAD  handles the assignment of
  2004.        plotter pens to drawing colors.
  2005.  
  2006.        The SELECT SPEED code chooses a drawing speed for a variable speed
  2007.        plotter.   The code  is followed  by an  argument that selects the
  2008.        speed.  Note that the speed argument is range checked and will not
  2009.        exceed the maximum speed configured, but is not otherwise checked.
  2010.        For a  plotter with  discrete speeds,  a  driver  processing  this
  2011.        command which  encounters a speed number the plotter cannot handle
  2012.        should send the next SLOWER speed.
  2013.  
  2014.        The SET  LINE TYPE code selects a plotter line font.  This code is
  2015.        followed by  an argument  which selects  the line  font.   It is a
  2016.        universal convention within AutoCAD that zero selects a continuous
  2017.        (solid line).  The meaning of the other fonts is up to the driver.
  2018.  
  2019.        The MOVE  code  is  followed  by  two  arguments,  specifying  the
  2020.        absolute coordinates to which the pen should be moved with the pen
  2021.  
  2022.        32
  2023.  
  2024.                       ADI Plotter Version 2.1 - Chapter 4
  2025.  
  2026.  
  2027.        up.   The coordinates  are specified  X first,  Y second,  both as
  2028.        unsigned numbers in the inclusive range from 0 to 65535.
  2029.  
  2030.        The DRAW  code  is  followed  by  two  arguments,  specifying  the
  2031.        absolute coordinates to which the pen should be moved with the pen
  2032.        down.   The coordinates  are specified  X first, Y second, both as
  2033.        unsigned numbers in the inclusive range from 0 to 65535.
  2034.  
  2035.        The END  PLOT code  is output  at the  end of  a plot.   It has no
  2036.        arguments.
  2037.  
  2038.        The ABORT PLOT is relevant only for installed drivers.  It is sent
  2039.        to indicate  that the  plot has  been terminated  by the  user  by
  2040.        pressing the  interrupt key.  If the plot is being sent to a file,
  2041.        this action causes the file not to be generated, so the ABORT PLOT
  2042.        code will  never be  seen by a program processing a plot file.  An
  2043.        installed driver  will receive  the code to indicate that abnormal
  2044.        termination  action  should  be  taken  (flushing  a  buffer,  for
  2045.        example).   This code  will be followed by an END PLOT code, which
  2046.        should perform  the usual  end of  plot functions (such as putting
  2047.        the pen back).
  2048.  
  2049.        4.4.1     File Format
  2050.  
  2051.        If the  output format  is an  ASCII file,  each plot  command will
  2052.        appear on  a new  line, starting  in the  first text  column.  All
  2053.        codes and  arguments  appear  as  decimal  numbers,  separated  by
  2054.        commas.   Type A codes appear by themselves.  Type B codes consist
  2055.        of the  command code  followed by  the argument.    Type  C  codes
  2056.        consist of  the command  code, followed  by the X coordinate and Y
  2057.        coordinate, comma delimited.  All numbers appearing in a plot file
  2058.        are unsigned.   Arguments  to type B codes are in the range from 0
  2059.        to 127,  and arguments to type C codes range from 0 to 65535.  The
  2060.        following is  an actual  plot file generated by plotting a square.
  2061.        The annotations  did not  appear in  the original  file, but  were
  2062.        added to explain the commands.
  2063.  
  2064.           1,1                        Begin plot, file level 1
  2065.           8                          Pen change (start of pass)
  2066.           5,1                        Select new pen 1
  2067.           7,0                        Select line type 0 (solid)
  2068.           6,1                        Select speed 1
  2069.           3,0,6953                   Move to 0, 6953 - pen up
  2070.           4,6954,6953                Draw to 6954, 6953 - top of square
  2071.           4,6954,0                   Draw to 6954, 0 - right side
  2072.           4,0,0                      Draw to 0,0 - bottom
  2073.           4,0,6953                   Draw to 0, 6953 - left side
  2074.           2                          End of plot
  2075.  
  2076.        In a binary file, the codes and arguments appear precisely as they
  2077.        do in  an ASCII  file, but  are stored  as binary numbers.  Type A
  2078.        codes are  written as  single bytes.   Type  B codes  consist of a
  2079.  
  2080.                                                                        33
  2081.  
  2082.                       ADI Plotter Version 2.1 - Chapter 4
  2083.  
  2084.  
  2085.        single byte  code, followed  by a one byte argument.  Type C codes
  2086.        are written  as a  single  byte  code,  followed  by  two  16  bit
  2087.        arguments representing  the X  and Y  coordinates.   Each  16  bit
  2088.        argument is written least significant byte first, most significant
  2089.        byte last,  the standard  8086 representation.  The following is a
  2090.        hexadecimal dump  of a  binary file  generated by the same drawing
  2091.        which created the ASCII file above.  Spacing has been added to the
  2092.        dump to aid readability.
  2093.  
  2094.           01 01
  2095.           08
  2096.           05 01
  2097.           07 00
  2098.           06 01
  2099.           03 00 00 29 1B
  2100.           04 2A 1B 29 1B
  2101.           04 2A 1B 00 00
  2102.           04 00 00 00 00
  2103.           04 00 00 29 1B
  2104.           02
  2105.  
  2106.        4.5 Installed Driver Operation
  2107.  
  2108.        The generic  plotter driver  can  communicate  with  an  installed
  2109.        driver.   This allows  the development  of a  driver  which,  once
  2110.        loaded in  memory, acts  exactly like  a driver implemented within
  2111.        AutoCAD itself:   plots  are performed  in real  time, without the
  2112.        need for  an intermediate file.  Installed drivers are implemented
  2113.        as MS-DOS  programs that "terminate and remain resident"; they are
  2114.        not true  DOS device drivers (although an alternate approach is to
  2115.        use a DOS device driver and send the file output to it).
  2116.  
  2117.        The installed  driver should  patch itself into a vacant interrupt
  2118.        location  then   exit  to   DOS,  remaining  resident  in  memory.
  2119.        Installation of  the driver must be accomplished before AutoCAD is
  2120.        executed.
  2121.  
  2122.        When the  generic driver  is configured,  the installed  driver is
  2123.        selected by  the "3"  reply to  the  output  format  query.    The
  2124.        interrupt vector  at which  the driver  installed itself  must  be
  2125.        specified at configuration time.
  2126.  
  2127.        When a  plot is made, the generic plotter driver will first make a
  2128.        rudimentary check to see if the driver is installed:  it will test
  2129.        the interrupt  vector and  only proceed  if it is nonzero.  If the
  2130.        interrupt vector is zero, the message:
  2131.  
  2132.        ** No driver is installed for interrupt vector 0XX **
  2133.  
  2134.        will be  issued, specifying  the interrupt  vector in hexadecimal,
  2135.        and the plot will be canceled.
  2136.  
  2137.        34
  2138.  
  2139.                       ADI Plotter Version 2.1 - Chapter 4
  2140.  
  2141.  
  2142.        If the  driver is  properly installed,  each plot  command will be
  2143.        sent to  it  by  loading  the  command  code  and  arguments  into
  2144.        registers and  then calling  the driver with an INT instruction to
  2145.        the configured  vector.   The command code is always passed in AX.
  2146.        For type B commands, the first argument is passed in BX.  For type
  2147.        C commands,  the X coordinate is passed in BX and the Y coordinate
  2148.        in CX.
  2149.  
  2150.        The driver  should return  with AX  zero.   (This is not currently
  2151.        checked, but  may be used in the future for a driver status).  The
  2152.        driver must  preserve the  contents of  all segment registers, and
  2153.        the registers SI and DI.
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.                                                                        35
  2193.  
  2194.                       ADI Plotter Version 2.1 - Chapter 4
  2195.  
  2196.  
  2197.        4.6 ADI Plotter Test Procedures
  2198.  
  2199.        1) Configure AutoCAD  for the  plotter to  be tested.   Cable  the
  2200.           plotter  as   documented  in   the  AutoCAD   Drafting  Package
  2201.           Installation/Performance Guide.
  2202.  
  2203.        2) Use the PLTST2.DWG to test:
  2204.  
  2205.           a) Scaling -Plot  the view  named "SCALE"  to a specified scale
  2206.              (e.g. 1=1).   Measure the  dimensioned parts  of the drawing
  2207.              checking that they are plotted to the scale specified.
  2208.  
  2209.           b) 90 Degree  Rotation -  Plot the drawing specifying 90 degree
  2210.              rotation, MAX  size paper,  FIT.  The plot should be rotated
  2211.              90 degrees.  The plot should not be truncated; if it is, the
  2212.              paper size is incorrect.
  2213.  
  2214.           c) Linetypes, Pen  changes, and  Pen speeds - Change the layers
  2215.              in the drawing to use the linetypes supported on the plotter
  2216.              (as documented in the Installation Guide).  Also, change the
  2217.              layers to  different pen numbers and pen speeds supported on
  2218.              the plotter.   Plot  the drawing.   Check that the different
  2219.              line types  were plotted.   Check that the correct pens were
  2220.              used.   If the  plotter only  supports one  pen, time should
  2221.              have been allowed between plot layers to change the pen.  If
  2222.              multiple pen  speeds are  allowed, the  different pen speeds
  2223.              should have been used during the plot.
  2224.  
  2225.           d) Origin Offset  - Plot the drawing, specifying an offset from
  2226.              the origin.   The  plot should  move the specified number of
  2227.              units from the origin.
  2228.  
  2229.           e) MAX Size  - Plot  EXTENTS, MAX  size, FIT, no rotation.  The
  2230.              drawing should not be truncated.
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.        36
  2248.  
  2249.       ___________________________________________________________________
  2250.  
  2251.                                    Chapter 5
  2252.  
  2253.  
  2254.                      THE ADI PRINTER/PLOTTER SPECIFICATION
  2255.  
  2256.        __________________________________________________________________
  2257.  
  2258.  
  2259.        The following  describes, in  detail, the  interface specification
  2260.        for ADI Printer/Plotter drivers.
  2261.  
  2262.        5.1 The ADI Printer/Plotter
  2263.  
  2264.        The  ADI   Development  Kit  allows  manufacturers  and  users  to
  2265.        interface AutoCAD  to printers  that Autodesk  does  not  directly
  2266.        support.   The sample  included in  the  ADI  Kit  demonstrates  a
  2267.        printer/plotter that simply uses asterisks and spaces for output.
  2268.  
  2269.        5.2 Configuration
  2270.  
  2271.        Printer/plotters come  in a  variety of resolutions and sizes, and
  2272.        some support  color output.   AutoCAD  must know  these parameters
  2273.        before it  can begin  a plot.   These  parameters are  set  during
  2274.        configuration of the ADI printer/plotter.
  2275.  
  2276.        First the  maximum paper size and resolution are specified.  These
  2277.        arguments may  be specified  either in inches or millimeters.  The
  2278.        units are selected by the prompt:
  2279.  
  2280.           Next you  will specify  the maximum  plot size the printer  can
  2281.           make, and  its resolution  (dots per  unit).   You may  specify
  2282.           these either  in millimeters  or inches.   The   next  question
  2283.           selects the units.
  2284.  
  2285.           Specify plot size in millimeters? <N>
  2286.  
  2287.        If the  answer is  the default, "no," the prompts which follow and
  2288.        their responses  will refer to inches, otherwise millimeters.  The
  2289.        examples given below assume inches were selected.
  2290.  
  2291.           Maximum horizontal (X) plot size in inches? <11.0>
  2292.           Printer dots per inch in the horizontal (X) direction: <100.0>
  2293.  
  2294.           Maximum vertical (Y) plot size in inches? <8.5>
  2295.           Plotter dots per inch in the vertical (Y) direction: <100.0>
  2296.  
  2297.        These parameters  are floating  point numbers  which are  used  to
  2298.        compute the  printer X  and Y  size in dots.  The calculated sizes
  2299.        may not  exceed 65535.   If  the specifications  given exceed  the
  2300.        limit, the  following message will appear (after the dots per unit
  2301.        are specified):
  2302.  
  2303.                                                                        37
  2304.  
  2305.                   ADI Printer/Plotter Version 2.1 - Chapter 5
  2306.  
  2307.  
  2308.           ** Error:  Plot size  multiplied by dots per inch cannot exceed
  2309.           65535.  Specifications resulted in ?????.
  2310.  
  2311.        The question marks in the prompt are replaced by the size the user
  2312.        tried to configure.  After this error message, the pair of prompts
  2313.        for plot size and dots per unit are reissued.
  2314.  
  2315.        Finally, the  driver's output  format is  selected.  The following
  2316.        prompt is issued:
  2317.  
  2318.           Select output format:
  2319.  
  2320.           0. Binary file
  2321.           1. CAD/camera image file
  2322.           2. Installed INT driver
  2323.  
  2324.           Output format, 0 to 2 <0>:
  2325.  
  2326.        The binary  file format  will be  described later.  The CAD/camera
  2327.        image file  format is  described in  the AutoCAD  Drafting Package
  2328.        Installation/Performance Guide  under ADI  Printer/Plotter.    The
  2329.        generic driver  can also send commands to a resident driver via an
  2330.        INT call.  If this option is selected via option 2, the additional
  2331.        question:
  2332.  
  2333.           Hexadecimal interrupt code (INT 0XXh) <7B>:
  2334.  
  2335.        will be  issued.   The response selects the interrupt vector to be
  2336.        used to  communicate with the printer/plotter driver.  The default
  2337.        is 7Bh.   Any vector from 1 to 0FFh is permissible.  If an invalid
  2338.        reply is entered, the message:
  2339.  
  2340.           ** Interrupt number must be between 1 and 0FF
  2341.  
  2342.        is given and the prompt reissued.
  2343.  
  2344.        If binary  file format  is selected, the user must specify whether
  2345.        color information  is to  be written  to the  file  (an  installed
  2346.        driver provides  this information  to  AutoCAD  at  initialization
  2347.        time, so  this question  does not appear if an installed driver is
  2348.        selected).  The prompt is:
  2349.  
  2350.           Does the printer/plotter support color? <N>
  2351.  
  2352.        If answered  with the default of "No", the output file will be one
  2353.        bit per pixel.  If color is selected, the output will be four bits
  2354.        per pixel,  and will  contain color  information.  See the AutoCAD
  2355.        Drafting Package  Installation/Performance Guide  for examples  of
  2356.        how various printers handle color information.
  2357.  
  2358.        Once the  driver-specific configuration  is completed, the regular
  2359.        printer/plotter  configuration   is  performed.      The   generic
  2360.  
  2361.        38
  2362.  
  2363.                   ADI Printer/Plotter Version 2.1 - Chapter 5
  2364.  
  2365.  
  2366.        printer/plotter driver remembers all its configuration options and
  2367.        supplies them  as defaults  on  subsequent  configurations.    The
  2368.        defaults given  in the  prompts above  are those  assumed on a new
  2369.        configuration of the driver.
  2370.  
  2371.        5.3 Using the Driver
  2372.  
  2373.        If binary  file output  format has  been selected,  when a plot is
  2374.        made with  the driver,  following all  the  runtime  printer  plot
  2375.        configuration dialogue, the prompt:
  2376.  
  2377.           Enter file name for plot:
  2378.  
  2379.        will appear.   The  user should  reply with  the file in which the
  2380.        printer plot data should be written.  The name may be entered with
  2381.        a file  type, if  desired.   If none  is specified, ".PRP" will be
  2382.        used (or  "IMG" for  CAD/camera image  file output).   If the file
  2383.        cannot be opened, the message:
  2384.  
  2385.           Cannot open this file.  Try another name? <N>
  2386.  
  2387.        will appear.  If answered affirmatively, the file name prompt will
  2388.        reappear; otherwise the plot will be canceled.
  2389.  
  2390.        5.4 Output Format
  2391.  
  2392.        Regardless of whether the output is being written to a binary file
  2393.        or passed  directly to  an installed  driver, printer plot data is
  2394.        represented in  a uniform  fashion.   Each record  in the  file or
  2395.        message to the installed driver begins with a single 16 bit value.
  2396.        If the  sign bit  is set  in this value, it is a control function,
  2397.        otherwise it  is a  count specifying  the number  of bytes of plot
  2398.        data that follow.  The function codes are given below.
  2399.  
  2400.           Function    Code                Arguments
  2401.  
  2402.           Begin plot  8001h          File_level, Xdots, Ydots, Color
  2403.           End plot    8002h
  2404.           Abort plot  8003h
  2405.  
  2406.        A binary  file will  begin with  the BEGIN  PLOT code  (all 16 bit
  2407.        values in  the file  are written  in standard 8086 fashion:  least
  2408.        significant byte  first, most  significant byte last), followed by
  2409.        the 16 bit values FILE LEVEL, XDOTS, YDOTS, and COLOR.  FILE LEVEL
  2410.        identifies the  format of  the file  for upward compatibility with
  2411.        future extensions.   Files  written by  this version of the driver
  2412.        will have  a file  level of  1.    XDOTS  and  YDOTS  specify  the
  2413.        horizontal and  vertical size,  respectively, of  the printer  for
  2414.        which this  file was  generated.   COLOR will  be 0 if the file is
  2415.        monochrome format  (one bit  per pixel) and 1 if the file is color
  2416.        format (4 bits per pixel).
  2417.                                                                        39
  2418.  
  2419.                   ADI Printer/Plotter Version 2.1 - Chapter 5
  2420.  
  2421.  
  2422.        Following the  BEGIN PLOT  record are  zero or  more line records.
  2423.        Each line  record consists of a 16 bit byte count followed by that
  2424.        number of  bytes of  raster data.    If  the  printer/plotter  was
  2425.        configured as supporting color, each byte will contain two pixels,
  2426.        with 4  bits per  pixel indicating  color.  If the printer/plotter
  2427.        was configured  as monochrome, 8 one bit pixels will be stored per
  2428.        byte.   In either  case, pixels  are arranged  on the page left to
  2429.        right starting  with the  most significant  pixel  of  each  byte,
  2430.        proceeding to  the least  significant, then continuing to the next
  2431.        byte.   Records in  the file  are variable  length; trailing  zero
  2432.        bytes are  not written.   A totally blank line on the printer will
  2433.        be written  with a  byte count  of 0  and no following data bytes.
  2434.        Totally blank  lines at the end of the plot are not written to the
  2435.        file.   Consequently there  may be  fewer line records in the file
  2436.        than the YDOTS count given in the BEGIN PLOT record.
  2437.  
  2438.        The end  of the plot is indicated by an END PLOT record instead of
  2439.        a byte  count word.  The ABORT PLOT item will never be encountered
  2440.        in a printer plot file because aborting the plot causes the output
  2441.        file to  be deleted.   It  is passed  to an  installed  driver  to
  2442.        apprise it of the abnormal termination of the printer plot.
  2443.  
  2444.        5.5 Installed Driver Operation
  2445.  
  2446.        The  generic   printer/plotter  driver  can  communicate  with  an
  2447.        installed driver.   This allows the development of a driver which,
  2448.        once loaded  in memory,  acts exactly  like a  driver  implemented
  2449.        within AutoCAD  itself:  printer plots are performed in real time,
  2450.        without the  need for an intermediate file.  Installed drivers are
  2451.        implemented  as   MS-DOS  programs   that  "terminate  and  remain
  2452.        resident"; they  are not  true DOS  device drivers.  The installed
  2453.        driver should  patch itself  into a vacant interrupt location then
  2454.        exit to  DOS, remaining  resident in  memory.  Installation of the
  2455.        driver must  be accomplished  before AutoCAD  is  executed.    The
  2456.        standard interrupt  vector  for  printer/plotter  drivers  is  07B
  2457.        hexadecimal.
  2458.  
  2459.        When the  generic driver  is configured,  the installed  driver is
  2460.        selected by  the "2"  reply to  the  output  format  query.    The
  2461.        interrupt vector  at which  the driver  installed itself  must  be
  2462.        specified at configuration time.
  2463.  
  2464.        When a  printer plot  is made,  the generic printer/plotter driver
  2465.        first makes a rudimentary check to see if the driver is installed:
  2466.        it will  test the  interrupt vector  and only  proceed  if  it  is
  2467.        nonzero.  If the interrupt vector is zero, the message:
  2468.  
  2469.           ** No printer driver is installed at interrupt vector 0XX **
  2470.  
  2471.        will be  issued, specifying  the interrupt  vector in hexadecimal,
  2472.        and the plot will be canceled.
  2473.  
  2474.        40
  2475.  
  2476.                   ADI Printer/Plotter Version 2.1 - Chapter 5
  2477.  
  2478.  
  2479.        Commands are passed to the installed driver through the registers.
  2480.        The function  code or  length in  bytes of  the data  is passed in
  2481.        register  AX.  The driver should examine AX and react accordingly.
  2482.  
  2483.        The BEGIN  PLOT code  is passed  with the  FILE LEVEL  in BX.  The
  2484.        configured size  of the printer/plotter in dots is passed with the
  2485.        horizontal size  in CX  and the  vertical size  in DX.  The driver
  2486.        must return with AX containing a status code: 1 if the printer was
  2487.        successfully initialized  and 0  otherwise.   BX should  contain a
  2488.        code which  selects monochrome  or  color  output  format,  0  for
  2489.        monochrome (1bit per pixel), 1 for color (4 bits per pixel).
  2490.  
  2491.        Successive lines  of plot data are passed with the length in bytes
  2492.        of each line in AX.  BX contains the offset address of the line of
  2493.        data,and CX  contains the  segment address  of  the  printer  data
  2494.        (thus, the  full 32  bit address  of the  line is  in CX:BX).   DX
  2495.        contains the  vertical position  of the  line on  the page  (since
  2496.        blank lines  within the plot are output, most driver will not need
  2497.        this value and may ignore it).  If the line is blank (AX is zero),
  2498.        CX and BX are meaningless.
  2499.  
  2500.        The end  of the  plot is signaled by the END PLOT code in AX.  The
  2501.        driver should eject the page and close out the printer plot.
  2502.  
  2503.        If the  printer plot  is aborted  by the  user,  the  driver  will
  2504.        receive the ABORT PLOT code in AX.  If possible, the driver should
  2505.        discard information  buffered for  the printer.   The  driver will
  2506.        receive an ENDPLOT code after the ABORT PLOT code.
  2507.  
  2508.        A sample  driver, intended  to illustrate  how an installed driver
  2509.        operates, and to exercise the facility for testing, is provided on
  2510.        the disk as PPDRV.C and PPDRV.EXE.
  2511.  
  2512.        This driver  sends its  data to  the  printer  in  "ultimate  dumb
  2513.        printer/plotter mode":   zero  bits are  printed as spaces and one
  2514.        bits as asterisks.  To configure a 132 column printer for use with
  2515.        this driver, answer the configuration questions:
  2516.  
  2517.           No          <use inches>
  2518.           13.2        <paper width>
  2519.           10          <characters per inch horizontal>
  2520.           10          <usable paper height>
  2521.           6           <characters per inch vertical>
  2522.  
  2523.        This driver  supports only  monochrome format (one bit per pixel).
  2524.        The driver  will read  a binary  output file  and send  it to  the
  2525.        printer when called with the command:
  2526.  
  2527.  
  2528.  
  2529.  
  2530.                                                                        41
  2531.  
  2532.                   ADI Printer/Plotter Version 2.1 - Chapter 5
  2533.  
  2534.  
  2535.           PPDRV <file>
  2536.  
  2537.        The extension  of .PRP  is supplied automatically.  The driver may
  2538.        be installed  into interrupt  vector  07Bh  by  calling  with  the
  2539.        command:
  2540.  
  2541.           PPDRV -I
  2542.  
  2543.        Once installed,  printer/plotter output may be sent directly to it
  2544.        by using the installed driver output option.
  2545.  
  2546.        5.6 ADI Printer/Plotter Test Procedures
  2547.  
  2548.        Use the test procedures outlined under ADI Plotter Test Procedures
  2549.        to test your completed ADI Printer/Plotter driver.
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.        42
  2585.  
  2586.        __________________________________________________________________
  2587.  
  2588.                                    Appendix A
  2589.  
  2590.  
  2591.                                 REVISION HISTORY
  2592.  
  2593.        __________________________________________________________________
  2594.  
  2595.  
  2596.        This appendix describes changes made in the ADI specification from
  2597.        previous versions.
  2598.  
  2599.        A.1 ADI Display Interface Version 2.0 (October, 1986)
  2600.  
  2601.        These additions  are supported in ADI display Vers. 2.0, available
  2602.        in AutoCAD Version 2.52, November, 1986.
  2603.  
  2604.        o  Added INIT4 Extended Functions ED_SYNC and EF_REDRAW.
  2605.        o  FLOOD function fixed to include color specification.
  2606.        o  MOVE calls added prior to FLOOD calls to pass highlight flag.
  2607.        o  DSCOMAND and  DSXPCOMD added  to enable  passing of transparent
  2608.           commands to the display driver.
  2609.        o  AutoCAD ADI  display driver  corrected to  handle selection  of
  2610.           interrupt vectors other than the default, 7Ah.
  2611.  
  2612.  
  2613.        A.2 ADI Display Interface Version 2.1 (December, 1986)
  2614.  
  2615.        These additions  are supported in ADI display Vers. 2.1, available
  2616.        as a driver update to AutoCAD Version 2.52, December, 1986.
  2617.  
  2618.        o  MOVE fixed  to recognize vectors that are not part of a drawing
  2619.           entity (e.g.  blips) and  which should not be redrawn on REDRAW
  2620.           calls.
  2621.        o  MODLINE call  fixed to  pass  correct  current  entity  drawing
  2622.           color.
  2623.        o  Fixed machine  hang when  ADI driver was not found at specified
  2624.           interrupt, or  when ADI  driver returned  0 (failure)  on INIT1
  2625.           call.
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.                                                                        43
  2637. --END OF ADIKIT.DOC--
  2638.